Search This Blog

Popular Posts

Wednesday, December 21, 2011

Database assignment solutions TCS ASPIRE

Question 1: Provide the create table syntax to Create a Table Employee whose details are as below.
Employee(EmployeeID, LastName, FirstName, Address, DateHired)
Answer:
CREATE TABLE Employee (EmployeeID int(10) , LastName varchar(45),
FirstName varchar(45), Address varchar(45), DateHired datetime,
PRIMARY KEY (EmployeeID) );

Question 2: Provide the INSERT query to be used in Employee Table to fill the Details.
Answer:
insert into Employee values(1,'dwivedi','anand','lucknow','2011-12-20');

Question 3: When we give SELECT * FROM EMPLOYEE .How does it Respond?
Answer: it gives all the records of employee table.

Question 4: Create a Table CLIENT whose details are as below.
Client(ClientID, LastName, FirstName, Balance, EmployeeID)
Answer:
CREATE TABLE CLIENT(ClientID integer(10),
LastName varchar(45), Balance float(45), EmployeeID integer(10),
PRIMARY KEY (ClientID));

Question 5: Provide the INSERT query to be used in CLIENT Table to fill the Details.
Answer: insert into CLIENT values(1,'abc',100.04,25);

Question 6: When we give SELECT * FROM CLIENT .How does it Respond?
Answer: It returns all records from 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

Answer: 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

Answer: b

Question 9: What are the different data types available in SQL server?
Answer: Data types in SQL Server are organized into the following categories:
1. Exact numerics
2. Approximate numerics
3. Date and time
4. Character strings
5. Unicode character strings
6. Binary strings
7. Others


Question 10: Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
Answer:
DDL: Data Definition Language is the subset which is used to manipulate Oracle database structures. i.e. Create, Alter, Drop

DML statements manipulate only data within the data structures already created by DDL statements.

Question 11: What operator performs pattern matching?
Answer: "like" is the operator used in pattern matching.

Question 12: What operator tests column for the absence of data?
Answer: "is null" operator
Example: select employeeID from Employee where Address is null

Question 13: Which command executes the contents of a specified file?
Answer: START or @.

Question 14: What is the parameter substitution symbol used with INSERT INTO command?
Answer: & is substitution symbol used with insert into command.

Question 15: Which command displays the SQL command in the SQL buffer, and then executes it?
Answer: Run

Question 16: What are the wildcards used for pattern matching?
Answer:
_ for single character substitution
% for multi-character substitution
[charlist] wildcard

Question 17: State whether true or false.
EXISTS, SOME, ANY are operators in SQL.
Answer: True

Question 18: State whether true or false.
!=, <>, ^= all denote the same operation.
Answer: True

Question 19: What are the privileges that can be granted on a table by a user to others?
Answer: 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?
Answer:
"revoke" is the command which revokes access privileges for database objects previously granted to other users.


Question 21: Which system tables contain information on privileges granted and privileges obtained?
Answer: user_tab_privs_made , user_tab_privs_recd

Question 22: Which system table contains information on constraints on all the tables created?
Answer:
USER_CONSTRAINTS (show all constraints created by the user who has logged in)
ALL_CONSTRAINTS (accessible for dba user only)

Question 23: What is the difference between TRUNCATE and DELETE commands?
Answer:
1. TRUNCATE is a DDL command whereas DELETE is a DML command.
2. TRUNCATE is much faster than DELETE.
3.You cannot rollback in TRUNCATE but in DELETE you can rollback.
TRUNCATE removes the record permanently.
4.In case of TRUNCATE ,Trigger doesn't get fired.But in DML commands like DELETE ,Trigger get fired.
5.You cannot use conditions(WHERE clause) in TRUNCATE.But in DELETE you can write conditions using WHERE clause

Question 24: What command is used to create a table by copying the structure of another table?
Answer: Select * into newtablename from oldtablename

1 comment:

  1. Appreciation for nice Updates.Thanks for all your valuable information on this topic.Database Solutions

    ReplyDelete