Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Create tables for the following relation schemas. STUDENT(Name, studentNo, major) GRADEREPORT(StudentNo, sectionID, Grade) The required data type of each attribute is described as below:

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. Create tables for the following relation schemas. STUDENT(Name, studentNo, major) GRADEREPORT(StudentNo, sectionID, Grade) The required data type of each attribute is described as below: . . . STUDENT.name is a variable length character string with no more than 40 characters (varchar2 (40)). STUDENT. student No is a 10-digitnumber, so is GRADEREPORT.StudentNo. (number (10)) STUDENT.major is a fixed-length string of 4 characters (char(4)). GRADEREPORT.sectionID is a 6-digit number (number (6)). GRADEREPORT.Grade is a single letter (char(1)) Your SQL program should specify each attribute type accordingly and appropriate constraints including primary keys and foreign keys, if any. Tip: Run the drop table command first before the create table command. Here is an example: drop table Grade Report cascade constraints; create table Grade Report . 2. Insert 3 rows to each table. 3. (a) Run the following codes to create EMPLOYEE and DEPARTMENT tables: drop table DEPT cascade constraints; create table DEPT ( DNUMBER number (2), Dname varchar2 (30), primary key (DNUMBER)); drop table EMP cascade constraints; create table EMP ( EID number (4) primary key, DNO number (2), AGE integer check(age >=18), foreign key (DNO) references DEPT) Insert into DEPT values (1, SALES); Insert into DEPT values (2) MARKETING') Insert into EMP values (1111, 1, 27); Insert into EMP values (2222, 1, 54); Insert into EMP values (3333, 2, 30); (b) List EMP table SELECT * FROM EMP; (c) Run the following code and see what you get and explain why? (Tip: list the table EMP after executing the code). Insert into EMP values (22.2254); Insert into EMP values (4444, 4, 54) Insert into EMP values (555510) 4. (a) Re-create DETP and EMP tables using the following code: drop table DEPT cascade constraints; create table DEPT ( DNUMBER number (2), Dname varchar2 (30)); drop table EMP cascade constraints; create table EMP ( EID number (4), DNO umber (2), AGE integer); Insert into DEPT values (1, SALES) ; Insert into DEPT values (2, MARKETING'); Insert into EMP values (1111, 1, 27); Insert into EMP values (2222, 1, 54); Insert into EMP values (3333, 2, 30); (b) Run the following code that is the same as 3c) and see what you get and explain w list the table EMP both before and after executing the code). Insert into EMP values 022221, 54); Insert into EMF values (4444, 4, 54); Insert into EMP values (5855, 1, 0)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions