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...
Consider the following relational schema: Faculty(fid: integer, fname: string, deptid: integer) Student(snum: integer, sname: string, major:...
Consider the following relational schema: Faculty(fid: integer, fname: string, deptid: integer) Student(snum: integer, sname: string, major: string, level: string, age: integer) Class(name: string, meets_at: time, room: string, fid: integer) Enrolled(snum: integer, cname: string) Enrolled has one record per student-class pair such that the student is enrolled in the class. Write an SQL assertion for the following integrity constraint: “Every faculty member must teach at least two courses.”
Having below tables: create table Student(sid char(10) primary key, sname varchar(20) not null, gpa float, major...
Having below tables: create table Student(sid char(10) primary key, sname varchar(20) not null, gpa float, major char(10), dob DATE); create table Course(cno char(10) primary key, cname varchar(20) not null, credits int, dept char(10)); create table Reg( sid references Student(sid) on delete cascade, cno references Course(cno) on delete cascade, grade char(2), primary key (sid, cno)); questions For each course, display the number of students who got each grade, ordered by the course and the letter grade. List the current age in...
Having below tables: create table Student(sid char(10) primary key, sname varchar(20) not null, gpa float, major...
Having below tables: create table Student(sid char(10) primary key, sname varchar(20) not null, gpa float, major char(10), dob DATE); create table Course(cno char(10) primary key, cname varchar(20) not null, credits int, dept char(10)); create table Reg( sid references Student(sid) on delete cascade, cno references Course(cno) on delete cascade, grade char(2), primary key (sid, cno)); questions (Oracle live SQL) For each course, display the number of students who got each grade, ordered by the course and the letter grade. List the...
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...