Saturday, 5 November 2011

DBMS TCS pre-ilp Assignment




My friend was preparing for his aspire assignments , he informed me that this materials would help many students.Thanks to my friend and ilp community.This material i hope will inculcate a good idea for creating your own answers.The material provided is only for idea gathering purpose only.Please dont try to mimic the answers,because  i believe you can come with with even more efficient answers.




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(6) primary key,LastName varchar(20),FirstName varchar(20),Address varchar2(50),datehired date );


Question 2:
Provide the INSERT query to be used in Employee Table to fill the Details.
ANS: Insert into Employee values( 100,'gourav','kishan','hyderabad','15-aug-45');



Question 3:
When we give SELECT * FROM EMPLOYEE .How does it Respond?
Ans: when we type the following query of select * from employee it returns all the data present that is all the columns in employee table. In this case it shows the above value in the insert statement.


Question 4:
 Create a Table CLIENT whose details are as below.
 Client(ClientID, LastName, FirstName, Balance, EmployeeID)
 ANS:create table Client(ClientID int(6), LastName varchar(20), FirstName varchar(20), Balance float(10) , EmployeeID foreign key references Employee(EmployeeID));
  NOTE: INCASE IF WE USE BOTH EMP AND CLIENT TABLE IN 1 DB..OR HAS A RELATION FOREIGN KEY OR NOT NULL AND REFERENCES ARE REQUIRED ELSE NO NEEDED.



Question 5:
Provide the INSERT query to be used in CLIENT Table to fill the Details.
 ANS:INSERT INTO Client
      values(&ClientID,'&LastName','&FirstName','&Address', &EmployeeId);


Question 6:
When we give SELECT * FROM CLIENT .How does it Respond?
ANS: It returns all the rows and columns present in the client table . that is it shows all the field data of client table.


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


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        : Stores numeric values.
    2) Monetary       : It stores numeric values with decimal
                     places. It is used specially for currency values.
    3) Date and Time  : It stores date and time information.
    4) Character      : It supports character based values of
                                   varying lengths.
    5) Binary         : It stores data in strict binary (0 or 1)
                               representation.
    6) Special purpose: SQL Server contains Complex data
        types to handle the XML Documents,Globally unique
        identifiers etc.


Question 10:
Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
 ANS: DDL( Data Deifinition 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.


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: '&' commonly known as amperescent operator.


Question 15:
Which command displays the SQL command in the SQL buffer, and then executes it?
  ANS: RUN.


 Question 16:
 What are the wildcards used for pattern Matching?
  ANS: _ and %
   _  = single character substitution .
   % = multiple character substitution.
[CHARLIST] = any single charecter in CHARLIST
^[CHARLIST] = any single charecter NOT in CHARLIST


 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: Insert, update, delete, select, references, index, execute, 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.Delete is a DML command and Truncate is a
              DDL  command.
           2.Where clause can be used with delete only.
           3.THE Delete operation can be rolled back, Truncate operation cant be rolled back again that is it is a permanent delete.


Question 24:
What command is used to create a table by copying the structure of another table?

ANS: CREATE TABLE .. AS SELECT command



No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...