Question: ( a ) create table STUDENT ( sid number ( 7 ) , sname varchar 2 ( 3 0 ) , sdno number ( 5
a create table STUDENT
sid number
sname varchar
sdno number;
A table named STUDENT is created in the database. Guess what is the meaning of number in the statement.
Answer:
b desc STUDENT
desc is an SQLPlus command. Therefore, it does not need to end with a semicolon. Explain the function of the SQLPlus command desc
Answer:
Note that this is a quite useful command to check the definition schema of a table.
c insert into STUDENT values 'John Doe', ;
commit;
Insert a tuple into the table. Note the order of the values in the parentheses. It must correspond to the order of the columns in the table definition.
commit is an SQL command that makes the insertion of the tuple to be permanent in the table. Without committing, the tuple will not be visible by other userssession It is related to transaction processing that will be discussed in future lectures. At this point, you only need to remember that after you insertdeleteupdate the content of some tables, type commit to make the changes permanent.
Now try:
insert into STUDENT values Mark Smith', ;
Write down what happened. Why?
Answer:
d select from STUDENT;
Display all the columns of all the rows in the table STUDENT.
e insert into STUDENT values 'Mark Smith', ;
commit;
select from STUDENT;
How many rows are there in the table?
Answer:
f delete from STUDENT where sid ;
commit;
select from STUDENT;
Delete statement: it deletes a row whose sid is from the table. Note that delete is usually used with a where clause to specify which rows to delete. A delete statement without a where clause will delete ALL the tuples in a table.
g select tablename from usertables;
This select statement returns only the tablename column from the table usertables. Usertables is a system table, which is part of Oracle data dictionary. It is automatically maintained by DBMS It contains tuples for every table created by the user. Since usertables has many columns check it with desc usertables we only display its tablename column.
h drop table STUDENT;
Remove the table STUDENT. Note that all the tuples within the table will be removed. Use it with care!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
