SQL Interview
SQL Interview
Marks: 20
Time: 30 Minutes
1. You need to display the last_name of those employees who have the letter “A” as the second
character in their names. Which SQL statement displays the required results?
2. Which of the following has been achieved by the following SQL codes?
SELECT * FROM employees WHERE hire_date < '01-01-1999' AND salary > 3500
a. only those hired before 1999 and earning less than $3500 a month are returned
b. compile time error
c. only those hired after 1999 and earning more than $3500 a month are returned
d. runtime error
e. only those hired before 1999 and earning more than $3500 a month are returned
4. Which SQL statement would you use to remove a table called EMP_DEPT_VU from your database?
a. DROP emp_dept_vu
b. DELETE FROM emp_dept_vu
c. REMOVE TABLEemp_dept_vu
d. DROP TABLE emp_dept_vu
e. TRUNCATE TABLE emp_dept_vu
a. COMMIT
b. UPDATE
c. DELETE
d. CREATE
e. DROP
SQL Server Test Paper
7. You need to produce a report for mailing labels for all customers. The mailing label must have only
the customer name and address. The CUSTOMERS table has these columns:
a. NOT NULL
b. CHECK
c. PRIMARY KEY
d. FOREIGN KEY
10. You need to change the definition of an existing table. The COMMERCIALS table needs a new
column DESCRIPTION which can hold characters up to 2000 bytes. Which statement is valid?
a. Remove the table from database by removing its relationships, constraints, grant and
revoke permissions.
b. Removes all rows from a table
c. Shortens the table to 10 rows
d. Removes all columns from a table
e. Removes foreign keys from a table
14. To raise the SAL of employees by 2000 for job CLERK and whose ENAME contains a ‘U’
a) Alter procedure
b) Modify procedure
c) Create Procedure
d) Update Procedure
a. Count
b. Max
c. Avg
d. Sum
e. Min
a) 1 b) 0 c) 3 d) None
19. To declare variable name which can hold 50 characters in SQL Server
a. Varchar name
b. Declare @name varchar
c. Declare @name varchar(50)
d. @name varchar(50)
SQL Server Test Paper
20. Which query retrieves the unique City from the Employee table?
a. SELECT DISTINCT City FROM Employee
b. SELECT UNIQUE City FROM Employee
c. SELECT DISTINCT *, City FROM Employee
d. SELECT MIN(City) FROM Employee