Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help! please ( database) with screenshots create tables for the following relation schema. student(name, student, major 1. Create tables for the following relation schemas. STUDENT(Name,

help! please ( database) with screenshots

create tables for the following relation schema. student(name, student, major

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.studentNo is a10-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 GradeReport cascade constraints; create table GradeReport ( ... ); 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 (2222, 1, 54); Insert into EMP values (4444, 4, 54); Insert into EMP values (5555, 1, 0); 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 number(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 why? (tip: list the table EMP both before and after executing the code). Insert into EMP values (2222, 1, 54); Insert into EMP values (4444, 4, 54); Insert into EMP values (5555, 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

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions