Relational Databases and SQL


Relational Databases
The relational model has a structural part (schemata with dependencies) and an operational part (relational algebra). The logical and physical levels are independent of each other. The only basic construct on the logical level is the relation; relations can be illustrated for the users in the form of tables.

student
student_id last_name first_name class phone
1 Jones Allan 2 555-1234
2 Smith John 3 555-4321
3 Brown Harry 2 555-1122
5 White Edward 3 555-3344

course
course_no course_name room time
101 French I 2-104 MW2
102 French II 2-113 MW3
105 Algebra 3-105 MW2
108 Calculus 2-113 MW4
enrollment
student_id course_no major
1 101 No
1 108 Yes
2 105 No
3 101 Yes
3 108 No
5 102 No
5 105 No

What Can SQL (Structured Query Language) Do?

Demonstration
Below is an SQL test area from W3Schools, which uses the well-known Northwind sample database. The tables here are for read only because of the problem of embedding the scripts. For a fully working example, check this by using Chrome.

SQL Statement:

Edit the SQL statement and click     to see the result, or  

Result:
The Database includes:
The Database includes:

TablenameRecord
Customers91
Categories8
Employees10
OrderDetails518
Orders196
Products77
Shippers3
Suppliers29


Review: Relational Databases
Which is NOT true about relational databases?
      A relational database can have only one table.
      Relations can be illustrated for the users in the form of tables.
      The relational database has a structural part (schemata with dependencies).
      The relational database has an operational part (relational algebra).
Result: