Presentation is loading. Please wait.

Presentation is loading. Please wait.

SY306 Web and Databases for Cyber Operations Databases - The Relational Model.

Similar presentations


Presentation on theme: "SY306 Web and Databases for Cyber Operations Databases - The Relational Model."— Presentation transcript:

1 SY306 Web and Databases for Cyber Operations Databases - The Relational Model

2 Web Architecture

3 Relational Model UserNameGenderAgeEmailPasswd AliceF19a@usna.eduwad354daa BobM21bob@usna.eduDdadha21hda GregM19greg@usna.eduSada3145ada JaneF18jane@gmail.comsadad45da45

4 Keys Key Primary key Candidate key Surrogate key

5 Foreign keys

6 ICE: Is This a Relation? Why? AXCA JohnRyanMD jr@gmail.com BobSmithMD, VA, NY bsm@gmail.com AliceBrownCA JaneDoeWA jd@yahoo.com JohnRyanMD jr@gmail.com 5454

7 ICE: Possible PK, AK ? XYZW JohnRyanMDjr@gmail.com BobSmithMDbsm@gmail.com AliceBrownCA JohnDoeWAjd@yahoo.com

8 8 SQL: CREATE TABLE CREATE TABLE table_name( column_name1 column_type1 [constraints1], …, [[CONSTRAINT constraint_name] table_constraint] ) Table constraints: NULL/NOT NULL PRIMARY KEY (columns) UNIQUE (columns) CHECK (conditions) FOREIGN KEY (local_columns) REFERENCES foreign_table (foreign_columns) [ON DELETE action_d ON UPDATE action_u] Specify surrogate key in MySQL: column_name int_type AUTO_INCREMENT

9 SQL: CREATE TABLE

10 ICE: Write the SQL to create the Courses table Courses(Cid, Cname, Cdept, CreditHours)

11 ICE: Write the SQL to create the Enrolled table Enrolled(Alpha, Cid, Semester, Grade)

12 SQL: DROP TABLE, ALTER TABLE

13 SQL: INSERT


Download ppt "SY306 Web and Databases for Cyber Operations Databases - The Relational Model."

Similar presentations


Ads by Google