Objective: The purpose of this assignment is to demonstrate the proper writing f
ID: 663239 • Letter: O
Question
Objective:
The purpose of this assignment is to demonstrate the proper writing for SQL code, there is NO NEED TO USE ORACLE, ACCESS, OR ANY DBMS (JUST A CODE IN MS WORD)
Assignment Deliverables:
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
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.
2.Write SQL statement to :
Insert at least three rows of fake data (any names, any addresses,
Explanation / Answer
1. create table STUDENT(Student_ID varchar2(10), First_Name varchar2(20), Last_Name varchar2(20), Street_Address varchar2(255), City varchar2(10), State varchar2(10), Zip_code number(10), Phone number(10), Email varchar2(20));
2. insert into STUDENT values ( '1013091', 'John', 'Smith', '3,Main Street', 'Warrington', 'UK', 18976,4473129739,'john_smith@gmail.com');
insert into STUDENT values ( '1013092', 'Martin', 'Ash', '12, Candy road', 'Chicago', 'US', 60290,0223211230,'M_ash@gmail.com');
insert into STUDENT values ( '1013093', 'Peter', 'Marc', '10,Downing Street', 'California', 'US', 55111,983121942,'Peter_m@gmail.com');
Alter table add column StudentStatus;
Alter table STUDENT add constraint chk_zip check (zip_code>=32114 and zip_code<=32117);
select count(*) from STUDENT;
Alter table STUDENT drop column StudentStatus;
create view Student_view as select First_Name, Last_Name, Email from STUDENT;
select * from STUDENT where zip_code=32116;
drop table STUDENT;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.