Write SQL code to create a STUDENT table that includes the following attributes:
ID: 3700332 • Letter: W
Question
Write SQL code to create a STUDENT table that includes the following attributes:
1. Write SQL code to create a STUDENT table that includes the following attributes: » Student ID » First Name » Last Name » Street Address City » State Zip Code » Phone » Email In the code remember to include data type, data size, and if that field is required or not. The selected data types and data size should be logical. For example you cannot use Char (10) for street address; size 10 is very small compared to many long street addresses that we deal with every day. Having a short size data will create error messages. Write SQL code to create the COURSE table. Add the proper attributes for the course table as needed. Remember to include data type, data size, and if that field is required or not. Write SQL statement to: 2. 3. Insert at least three rows of fake data (any names, any addresses, so on) into the two » tables created above. . Add a column called ExpecGradDate to the STUDENT table. . Add a new constraint to limit the student zip code to be within the following group (32117, 32116, 32115, 32114) » Count the number of rows in the table and save them in a new column » Show the first 3 records of data. Delete the column Exoec?tdDate, » Create a VIEW STATEMENT that shows only First Name, Last Name, and Email . Display records of students living in area code 32114. » Delete the table studentExplanation / Answer
All the answers are in sequence, as the questions are asked in the picture.
create table student
(
stud_id number primary key,
f_name varchar2(50),
l_name varchar2(50),
street varchar2(50),
city varchar2(50),
state varchar2(50),
zip number(6,0),
phone number(10,0),
email varchar2(50)
);
____________________________________________________________________________________________
create table COURSE
(
course_id number primary key,
course_name varchar2(50)
);
____________________________________________________________________________________________
insert into student values(1001, 'John','Watson','22B Baker Street','London','London',32116,1234567498,'hjonwatson@mmali.com')
insert into student values(1002, 'Sherlock','Holmes','22B Baker Street','London','London',32116,1234565666,'homes@mmali.com')
insert into student values(1003, 'Greg','Lestrade','22B Baker Street','London','London',32116,1234567411,'lestrade@mmali.com')
____________________________________________________________________________________________
insert into course values(101,'Maths')
insert into course values(102,'History')
insert into course values(103,'Biology')
____________________________________________________________________________________________
ALter table Student add ExpecGradDate date;
____________________________________________________________________________________________
Alter table Student add constraint zip_constraint check (zip >= 32114 and zip <= 32117)
____________________________________________________________________________________________
select count(*) as Total_rows from Student
____________________________________________________________________________________________
select * from student where rownum<=3
____________________________________________________________________________________________
alter table student drop column ExpecGradDate
____________________________________________________________________________________________
create view Student_View as (select f_name, l_name, email from student)
select * from student_view
____________________________________________________________________________________________
select * from student where zip = 32114
____________________________________________________________________________________________
drop table student
If there is anything that you do not understand, or need mre help with, then please mention it in the comments section.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.