Question

Consider the following relational database:               STUDENT     (STDNO, SNAME, DEPTNO#)             &n

Consider the following relational database:

              STUDENT     (STDNO, SNAME, DEPTNO#)

              DEP                 (DEPTNO, DNAME)

              COURSE        (CORSNO, CNAME, DEPTNO#, CMAX)

              ENROLMENT       (STDNO#, CORSNO#, GRADE, EDATE)

STUDENT.DEPTNO is the department number of the student.

COURSE.DEPTNO is the department number that offers the course.

ENROLMENT models the registrations of students in courses (M:M relationship) where the GRADE is the grade obtained by the student in the course.

PART I : DATA DESCRIPTION LANGUAGE (DDL)

  1. Write DDL commands to create the four tables without any constraint.

Nom de colonne

Signification

Type

Size

STDNO

Student Number

Number

8

SNAME

Student name

Varchar2

30

DEPTNO

Department Number

Varchar2

2

DNAME

Department name

Varchar2

20

CORSNO

Course Number

Number

3

CNAME

Course Name

Varchar2

30

CMAX

Max. students allowed

Number

2

GRADE

Obtained Grade

Number

2

EDATE

Enrolment date

Date

-

  1. Add all the following constraints:
  • Primary Key
  • Foreign Key
  • Constraints on the STUDENT table:
    • Sname: Mandatory
    • Each student must belong to a department
  • Constraint on the DEP table
    • Sname : Uppercase
  • Constraint on the COURSE table
    • Cmax: in the range 5 to 50 students
  • Constraint on the ENROLMENT table
  1. Edate: have a default value equal to the system date, Mandatory.

Homework Answers

Answer #1

DDL Commands to create without constraints:

  • create table STUDENT (STDNO integer(8),SNAME varchar(30),DEPTNO varchar(2));
  • create table DEP(DEPTNO varchar(2),dname varchar(20));
  • create table COURSE(CORSNO integer(3),CNAME varchar(30),DEPTNO varchar(2),CMAX integer(2));
  • create table ENROLMENT(STDNO integer(2),CORSNO integer(3),GRADE integer(2),EDATE DATETIME);

Adding Constraints:

  • alter table STUDENT add primary key(SNAME);
  • alter table DEP add primary key(DEPTNO);
  • alter table STUDENT add foreign key(DEPTNO) references DEP(DEPTNO);
  • alter table DEP change dname DNAME varchar(20);
  • alter table COURSE change CMAX CMAX integer(50);
  • ALTER TABLE ENROLMENT MODIFY COLUMN EDATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP;

Output Screenshots:

Thank you have a great day...Please do like....

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
14.19. Suppose that we have the following requirements for a university database that is used to...
14.19. Suppose that we have the following requirements for a university database that is used to keep track of students’ transcripts: a. The university keeps track of each student’s name (Sname), student number (Snum), Social Security number (Ssn), current address (Sc_addr) and phone (Sc_phone), permanent address (Sp_addr) and phone (Sp_phone), birth date (Bdate), sex (Sex), class (Class) (‘freshman’, ‘sophomore’, … , ‘graduate’), major department (Major_code), minor department (Minor_code) (if any), and degree program (Prog) (‘b.a.’, ‘b.s.’, … , ‘ph.d.’). Both...
1) Add to a relational table DEPARTMENT information about the total number of employees in each...
1) Add to a relational table DEPARTMENT information about the total number of employees in each department. Note, that if a department has not employee then for such a department the total number of employees must be set to zero (0). The total number of employees must be a positive number no more than 999. Use SELECT statement to list the contents of an extended relational table DEPARTMENT in the descending order of the total number of employees. Finally, remove...
Consider the following set of requirements for a UNIVERSITY database that is used to keep track...
Consider the following set of requirements for a UNIVERSITY database that is used to keep track of students’ transcripts. This is similar but not identical to the database shown in Figure 1.2: a. The university keeps track of each student’s name, student number, Social Security number, current address and phone number, permanent address and phone number, birth date, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program (B.A., B.S., ..., Ph.D.). Some user applications...
1.Consider the following (normalized) relational model (primary keys are underlined, foreign keys are in italics). EMPLOYEE(SSN,...
1.Consider the following (normalized) relational model (primary keys are underlined, foreign keys are in italics). EMPLOYEE(SSN, ENAME, EADDRESS, SEX, DATE_OF_BIRTH, SUPERVISOR, DNR) S U P E R V I S O R : foreign key refers to SSN in EMPLOYEE, NULL value allowed D N R : foreign key refers to DNR in DEPARTMENT, NULL value not allowed DEPARTMENT(DNR, DNAME, DLOCATION, MGNR) MGNR: foreign key refers to SSN in EMPLOYEE, NULL value not allowed PROJECT(PNR, PNAME, PDURATION, DNR) DNR: foreign...
Given the following relational database schema: Student = (SSN, Name, Major) Course = ( CourseNumber, PrerequisiteCourseNumber,...
Given the following relational database schema: Student = (SSN, Name, Major) Course = ( CourseNumber, PrerequisiteCourseNumber, Course Title, NumberUnits) Section = ( CourseNumber, Quarter, RoomNumber, DayTime), where DayTime is of the form MW 1:0-2:00PM. Enrollment = (SSN,CourseNumber, Quarter, Grade)// Grade is either Null or a letter grade. I'm looking for the DLL statements to make the tables above in SQL
Consider the following relations: Student(sID, surName, firstName, campus, email) Course(dept, cNum, name) 
Offering(oID, dept, cNum, term,...
Consider the following relations: Student(sID, surName, firstName, campus, email) Course(dept, cNum, name) 
Offering(oID, dept, cNum, term, instructor)
 Took(sID, oID, grade) Such as: Offering[dept, cNum] ⊆ Course[dept, cNum] Took[sID] ⊆ Student[sID]
 Took[oID] ⊆ Offering[oID] Answer the following query using relational algebra: Give the Student number of all students who have taken the course number “343” by the department “CS”. Find sID of all students who have earned some grade over 80 and some grade below 50. Find the Terms when the...
3-students take courses. Someone design this table: Student_Course (student name, ID , SSN , course number,...
3-students take courses. Someone design this table: Student_Course (student name, ID , SSN , course number, grade, home address, course credit ) Description: ID, SSN; each one has a unique value for a given student. Given ID and course number we can get grade. Given SSN and course number we can get grade. Given ID we can get everything except grade and course credit. Given SSN we can get everything except grade and course credit. Given course number we can...
SQL Data: you can just copy paste it into mysql to. CREATE DATABASE University;USE University; CREATE...
SQL Data: you can just copy paste it into mysql to. CREATE DATABASE University;USE University; CREATE TABLE Student (  sid INT PRIMARY KEY,  name VARCHAR(20) NOT NULL,  address VARCHAR(20) NOT NULL,  major CHAR(2)); CREATE TABLE Professor (  pid INT PRIMARY KEY,  name VARCHAR(20) NOT NULL,  department VARCHAR(10) NOT NULL); CREATE TABLE Course (  cid INT PRIMARY KEY,  title VARCHAR(20) NOT NULL UNIQUE,  credits INT NOT NULL,  area VARCHAR(5) NOT NULL); CREATE TABLE Transcript (  sid INT,  cid INT,  pid INT,  semester VARCHAR(9),  year YEAR,  grade CHAR(1) NOT NULL,  PRIMARY KEY (sid, cid, semester, year),  FOREIGN KEY (sid) REFERENCES Student...
Consider a relational DBMS that has two relations: Emp (employees) and Dept (departments).    Emp(id, name,...
Consider a relational DBMS that has two relations: Emp (employees) and Dept (departments).    Emp(id, name, age, salary, dname)    Dept(dname, location) - The Emp table has 500 tuples, and each tuple has a fixed length of 500 bytes. The primary key attribute "id" has a length of 40 bytes. - The Dept table has 100 tuples, and each tuple has 200 bytes. The primary key attribute "dname" has a length of 20 bytes. For simplicity, we assume each employee...
Consider the following relations: Student(sID, surName, firstName, campus, email) Course(dept, cNum, name) 
Offering(oID, dept, cNum, term,...
Consider the following relations: Student(sID, surName, firstName, campus, email) Course(dept, cNum, name) 
Offering(oID, dept, cNum, term, instructor)
 Took(sID, oID, grade) Such as: Offering[dept, cNum] ⊆ Course[dept, cNum] Took[sID] ⊆ Student[sID]
 Took[oID] ⊆ Offering[oID] Find the Terms when the course number “369” by the department “CS” was not offered.