1. What are the SQL statements to perform the following tasks? a) Create a table
ID: 3586407 • Letter: 1
Question
1. What are the SQL statements to perform the following tasks?
a) Create a tablespace Hw3Tbs that contains a 32MB datafile in directory ‘C:ppStudentoradatacsc544744TEMP’.
b) Add another 8MB to tablespace Hw3Tbs.
c) Create a new user UserForHw3. The user will use hw3pass as the password, and have 4MB of quota on the default tablespace Hw3Tbs and unlimited quota on tablespace USERS. The user should be allowed to create session and create tables in its schema.
c) Assume all tasks in problem 1 have been completed successfully and you logged into the database as user UserForHw3. What is the SQL statement to create a table TB1 with three columns a, b and c, where a is an integer with at most 5 digits and serves as the primary key, b is a string with exactly 8 characters, and c is string with at most 25 characters?
d) What is the SQL statement to insert a row (279, ‘computer’, ‘something’) into table TB1?
e) Assume steps c) and d) have been completed successfully. How many segments will be generated for table TB1?
Explanation / Answer
a. create tablespace Hw3Tbs
datafile 'C:ppStudentoradatacsc544744TEMPHw3Tbs.dbf' size 32M;
b. alter tablespace Hw3Tbs
add datafile 'C:ppStudentoradatacsc544744TEMPHw3Tbs.dbf' SIZE 8M;
C.
C) To create a user:
Create user UserForHw3 identified by hw3pass
default tablespace Hw3Tbs quota 4M on Hw3Tbs;
Now give unlimited quota on tablespace Users.
Alter user UserForHw3 quota unlimited on users;
Now provide access as below:
Grant create session to UserForHw3 identified by hw3pass;
grant create any table to UserForHw3 ;
----------------------------------------------------------------------------------------------------------------------
C) Create table TB1 (
a interger(5) not null primary key,
b VARCHAR2(8) not null,
c VARCHAR2(25) not null,
);
d. d) Insert into TB1 values (279, ‘computer’, ‘something’);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.