Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Relational Schema I don\'t quite understand what is the meaning of the word \"ov

ID: 3684923 • Letter: R

Question

Relational Schema

I don't quite understand what is the meaning of the word "over" in the above sentences...

For example, t1 is a table over STUDENT1, and thereby over the other scemata too.

I know this question sounds pretty dumb but could someone please explain that for me...Thank you.

Consider 4 different SQL table definitions (we omit domains) CREATE TABLE STUDENT! (id PRIMARY KEY. name NOT NULL); CREATE TABLE STUDENT2(id NOT NULL, name NOT NULL); CREATE TABLE STUDENT3(id UNIQUE, name NOT NULL) CREATE TABLE STUDENT4(id, name NOT NULL); Consider the following four tables: t4 t2 d name 1 Rihanna 1 Gaga t3 d name null Eminem 3 Eminem ti name d name null Eminem 1 Rihanna 1 Gaga 1 Rihanna 2 Gaga Which tables are instances of which table schema? t, is a table over STUDENT 1, and thereby over the other schemata too t2 is a table over STUDENT-21 and thereby a table over STUDENT4 t3 is a table over STUDENT31 and thereby a table over STUDENT4 t4 is a table over STUDENT4

Explanation / Answer

First try to understand the meaning of :

Primary key, Unique key,not null

Primary key: It cannot be null and it must be unique(duplication not allowed)

Unique key:It can be null and it must be unique(duplication not allowed)

Not null: It can not be null but duplication is allowed

if no constraint is defined for any column, then it can be null or not null and duplication is also allowed

Here id coloumn of all the tables differ by constraints and rest is same in all 4 tables

Now:

t1 is a table over STUDENT1, and thereby over the other scemata too : It means that table t1 is created based on the criteria of table STUDENT1 as defined above in which id is PRIMARY KEY.

If you see through the definitions i had given above then it also satisfies all other table conditions too eg STUDENT2,STUDENT3 & STUDENT4.

because

A primary key is always unique thus satisfy unique key constraint of table STUDENT3

A primary key is never null thus satisfy NOT NULL constraint of table STUDENT2

STUDENT4 table is a default table without any constraint thus STUDENT1 table satisfied its criteria too.

Similarly, table t2 is created based on the criteria of table STUDENT2 in which id is NOT NULL.

Thus , it satisfies the criteria of table STUDENT 4 which is a default table

It doesn't satisfy the criteria of table STUDENT 1 and STUDENT 3 because they can have id as UNIQUE(no duplicates) only beacuse NOT NULL doesn't promise to be unique.

Same you can conclude for other statements too.