Sei sulla pagina 1di 4

Database concepts Assignment 1Answers

-------------------------------------------------------------------------------Question 1: Provide the create table syntax to Create a Table Employee whose details are as below. Employee(EmployeeID, LastName, FirstName, Address, DateHired) Ans:: Create table Employee(EmployeeID int(10) primary key,LastName varchar(10),FirstName varchar(10),Address varchar(20),Datehired date); Question 2: Provide the INSERT query to be used in Employee Table to fill the Details. Ans::Insert into Employee values(100,Begum,Aaisha,hyderabad,date); Question 3: When we give SELECT * FROM EMPLOYEE .How does it Respond? Ans:: This query returns all the tuples present in the employee table. Till now, we have entered only 1 tuple with employeeID 100. So, it shows the inserted tuple. Question 4: Create a Table CLIENT whose details are as below. Client(ClientID, LastName, FirstName, Balance, EmployeeID) Ans::create table Client(ClientID int(10),LastName varchar(10),FirstName varchar(10),Balance float(10),EmployeeID foreign key references Employee(EmployeeID)); Question 5: Provide the INSERT query to be used in CLIENT Table to fill the Details. Ans::Insert into Client values (1,Begum,Razia,2520,100); Question 6: When we give SELECT * FROM CLIENT .How does it Respond? Ans:: It displays all the tuples present in Client table.Till now, we have entered only 1 tuple. So,it shows the entered tuple having ClientID as 1. Question 7: Choose the correct answer. The SQL command to create a table is: a. Make Table

b. Alter Table c. Define Table d. Create Table Ans:: D. Create Table Question 8: Choose the correct answer. The DROP TABLE statement: a. deletes the table structure only b. deletes the table structure along with the table data c. works whether or not referential integrity constraints would be violated d. is not an SQL statement Ans:: B Question 9: What are the different data types available in SQL server? Ans:: 1.Numeric 2.Monetary 3.Date and Time 4.Character 5.Binary 6.Special Purpose data type Some of the data types which we regularly use are char(),varchar(),int, smallint, numeric(p,d), real, double precision and float. Question 10: Which is the subset of SQL commands used to manipulate Oracle Database structures, includingtables? Ans:: DDL(Data Definition Language) Question 11: What operator performs pattern matching?

Ans:: LIKE operator Question 12: What operator tests column for the absence of data? Ans:: "IS NULL" operator is used to test column for the absence of data. Eg :- SELECT * FROM EMP WHERE COMMISSION IS NULL; Question 13: Which command executes the contents of a specified file? Ans:: START or @ command Question 14: What is the parameter substitution symbol used with INSERT INTO command? Ans:: &-- Because & is used for substitution variables . And INSERT INTO command is certainly not used before a substitution variable. Question 15: Which command displays the SQL command in the SQL buffer, and then executes it? Ans:: RUN is the command which displays the query in SQL buffer and executes it. Question 16: What are the wildcards used for pattern matching? Ans:: % for multiple character and _ (underscore) for a single character matching. Question 17: State whether true or false. EXISTS, SOME, ANY are operators in SQL. Ans:: TRUE Question 18: State whether true or false. !=, <>, ^= all denote the same operation. Ans:: TRUE Question 19: What are the privileges that can be granted on a table by a user to others? Ans:: Alter, delete, index, insert, references, select, update, alter, all

Question 20: What command is used to get back the privileges offered by the GRANT command? Ans:: REVOKE Question 21: Which system tables contain information on privileges granted and privileges obtained? Ans:: USER_TAB_PRIVS_MADE USER_TAB_PRIVS_RECD Question 22: Which system table contains information on constraints on all the tables created? Ans:: USER_CONSTRAINTS Question 23: What is the difference between TRUNCATE and DELETE commands? Ans:: 1. The Delete operation can be rolled back, Truncate operation cant be rolled back(it is a permanent delete operation). 2. WHERE clause can be used with DELETE only. 3. Delete is a DML command, whereas TRUNCATE is a DDL command. Question 24: What command is used to create a table by copying the structure of another table? Ans:: CREATE TABLE .. AS SELECT command.

Potrebbero piacerti anche