What is Schema in SQL with examples? | OCA Preparation -1

In my previous articles I have given multiple tutorials about SQL with real time industry examples. In this article I would like to throw light on what exactly the schema is and I will give you heads-up about multiple schema in oracle SQL .You can have look with using simple oracle online application and check the structure of the schema. Before we start checking- What is schema in SQL with examples? I would like to give you information about what exactly the SQL table is?  I would like to start writing this articles for Oracle SQL Certification Preparation ( OCA).The article give you the information about Schema in SQL with examples in detail.

In this article we will focus mainly on:

  1. What is SQL table?
  2. What is mean by Schema?
  3. Example of HR schema

What is SQL table?

Table is the basic storage for relational database management system. The entity which will give you the data in tabular format in SQL is called as table. We are using the table to store the records. The storing the records in table is easy to use and manage. In following diagram, we have showed the multiple tables inn diagrammatic representation.

The data is going to the database and it has saved in table format. In above diagram you can see the tables in database. t1,t2,t3 are tables in database which is using relational database management systems. We have many tables in one database and it has the relationship between them. We are using Entitiy Relationship diagram to show the relations between multiple table in database.

What is SQL Schema?

In previous section we have discussed about the SQL schema. In this section I would like to give more information about what exactly the SQL Schema means. The table is collection of data with its relationship. We are using the Entity relationship diagram to show the relations between different tables. The question now is what exactly the schema is?

Definition of SQL Schema :

The SQL Schema is nothing but the collection of multiple database objects together which may have the same functionality or same project. The SQL schema contains multiple database objects like tables,views,sequences,functions,triggers e.t.c.

I would like you to give you examples of schema from Oracle 12 c. There are so many in built schemas in Oracle 12 c. You can have look on multiple schemas online with using following oracle site.

https://livesql.oracle.com/apex/

The above site will give you direct read only access for multiple oracle schemas. I would like to explain the HR schema in detail so that you can have some exposure working directly on schema.

The above diagram gives you the information about multiple schema’s in oracle. So We are using the HR schema throughout this articles for preparation of OCA certification.

What is HR Schema and structure of HR Schema?

We already know that what exactly the schema is. In this section I would like to give you examples of HR schema in detail. The HR schema is in built oracle schema which is used to manage the Human resources data in detail. We have its entity relationship diagram ready developed by oracle. The entity relationship diagram of oracle HR schema will give you detailed information about relationship between the tables.

The above diagram will give you the ER diagram for HR schema. The blue marked columns are primary keys and the arrows are showing relationship between the tables.

Example :

I would like to give you one important example of relationship between tables. Lets say Jobs ad Employees table. There is one to many relationship between Jobs and Employees table. The Employee_id and job_id are primary keys for respective tables. The Job_oid will be the foreign key for the relationship between tables.

You can read more about Oracle 12 C architecture here :

https://docs.oracle.com/database/121/

I hope that you got clear idea about what is SQL schema in detail. If you like the article or if you have any issues with the same kindly comment in comments section.

2 Replies to “What is Schema in SQL with examples? | OCA Preparation -1”

Leave a Reply

Your email address will not be published. Required fields are marked *