|
In Relational Database Management Systems (RDBMS) data are represented using tables (relations). A query issued against the RDBMS also results in a table. A table has the following structure:
Column 1 |
Column 2 |
--------- |
Column n |
--- |
---- |
---- |
---- |
|
|
|
|
|
|
|
|
A table is uniquely identified by its name and consists of rows that contain the stored information, each row containing exactly one tuple (or record). A table can have one or more columns. A column is made up of a column name and a data type, and it describes an attribute of the tuples. The structure of a table, also called relation schema, thus is defined by its attributes. The type of information to be stored in a table is defined by the data types of the attributes at table creation time.
SQL uses the terms table, row, and column for relation, tuple, and attribute, respectively. A table can have up to 254 columns which may have different or same data types and sets of values (domains), respectively.
Before creation of the database we will find out the Tables, Table attributes and data types of the attributes. We will take the example of School Management System Database. This includes the details about the teachers, courses, students and marks. The following are structures of the tables in the system: -
Tables Used in the Database: - Teacher, Course, Student, Marks Structure of the tables: -
Teacher
Attribute Name | Data Type |
|---|
TeacherID |
Number(10) |
TeacherName |
Varchar2(30) |
Qualification |
Varchar2(30) |
Subject |
Varchar2(30) |
ContactNumber |
Number(10) |
Course
Attribute Name | Data Type |
|---|
CourseID |
Number(5) |
CourseName |
Varchar2(30) |
TotalCredits |
Number(3) |
No_ofSubjects |
Number(2) |
TeacherID |
Number(10) |
Student
Attribute Name | Data Type |
|---|
StudentID |
Number(10) |
StudentName |
Varchar2(30) |
Address |
Varchar2(30) |
CourseID |
Number(5) |
Marks
Attribute Name | Data Type |
|---|
StudentID |
Number(5) |
MarksObtained |
Number(4) |
MarksPercentage |
Number(4,2) |
Marks_Sub1 |
Number(2) |
Marks_Sub2 |
Number(2) |
Marks_Sub3 |
Number(2) |
Marks_Sub4 |
Number(2) |
Marks_Sub5 |
Number(2) |
|