Pages

Thursday, November 29, 2012

SQL INTERVIEW QUESTIONS

Q: What does the acronym SQL stand for?
Ans: STRUCTURED QUERY LANGUAGE

Q: What are the six main categories of SQL commands?
Ans:
Data definition language
Data Manipulation language
Data Query Language
Data Control Language
Data administration commands
Transactional control commands

Q: What are the four transactional control commands?
Ans:
Commit
Rollback
SAVE POINT
SET TRANSACTION

Q: Identify the categories in which the following SQL commands fall:
Ans:
1. CREATE TABLE =DDL
2. DELETE =DML
3.SELECT=DQL
4.INSERT=DML
5. ALTER TABLE=DCL
6. UPDATE=DML

Q:What is a database Schema?
Ans:
A database Schema is a set of interrelated database objects which are owned by a group or person.

Q: Difference between Unique and Primary Key?
Ans:
No two columns in a table can have a Primary Key
Two Columns can have a Unique Key in a table

Primary Key is referenced to Join Tables
Unique Key cannot be referenced

Unique Key can be Null
Primary Key is not Null

For Normalization use

http://programmerschoice.blogspot.in/2012/01/normalizing-database.html

Q
Write DML to accomplish the following:
a. Correct Billy Pierce's SSN to read 310239857.
UPDATE `emp_new` SET ssn =310239857 WHERE ssn =310239856
b. Add Ben Moore, PHONE is 317-5649880, ssn is 313456789.
INSERT INTO emp_new VALUES ('Moore', 'Ben', 313456789, 3175649880)
c. John Smith quit; remove his record.
DELETE FROM emp_new WHERE `FIRST_NAME` = 'JOHN' AND `LAST_NAME` = 'SMITH'

No comments:

Post a Comment