You are to create a table named sruDENT PROFILE With the following structure: Co
ID: 3753193 • Letter: Y
Question
You are to create a table named sruDENT PROFILE With the following structure: Column Name Type Precision Scale 10 Size STUD MATRIC (Primary Key) TUD NAME STUDI PHONE STUD ADDRESS STUD GENDER DOB CGPA PHOTO number varchar2 varchar?2 varchar?2 char date number blob 15 12 20 What is the SQL command for such table creation? Please note that you need to specify the STUD MATRIO column as a primary key. The primary key notation must be as part of the CREATE TABLe sou statement Next, add a column named STUD EMAIL with data type of number (precision: 10) to the STUDENT PROPILE table using a SQL statement. Next, you find that the data type of the newly added column, STUD EMAIL, is not appropriate. It should be a column of varchar2 with length of 20. Write a sQl statement to perform such task. Lastly, drop the STUDENT PROFILE table using a SQL statement.Explanation / Answer
You have not mentioned for which database you need the statements. Looking at the datatype, it appears to be Oracle. The following are the statements for each of the tasks. It will work in Oracle database
CREATE TABLE STUDENT_PROFILE
(
STUD_MATRIC NUMBER(10) not null,
STUD_NAME VARCHAR2(15),
STUD_PHONE VARCHAR2(12),
STUD_ADDRESS VARCHAR2(20),
STUD_GENDER CHAR(1),
DOB DATE,
CGPA NUMBER(3,2),
PHOTO BLOB,
CONSTRAINT STUDENT_PROFILE_PK PRIMARY KEY (STUD_MATRIC)
);
ALTER TABLE STUDENT_PROFILE
ADD STUD_EMAIL NUMBER(10);
ALTER TABLE STUDENT_PROFILE
MODIFY STUD_EMAIL VARCHAR2(20);
DROP TABLE STUDENT_PROFILE;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.