Database Management Systems (3130703) MCQs

MCQs of SQL Concepts

Showing 31 to 40 out of 68 Questions
31.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

DELETE ALL THE RECORDS OF EMPLOYEE TABLE HAVING SALARY GREATER THAN AND EQUALS TO 14000.

(a)

DELETE FROM EMPLOYEE WHERE SALARY >= 14000

(b)

DELETE INTO EMPLOYEE WHERE SALARY >= 14000

(c)

DELETE INTO EMPLOYEE WHOSE SALARY >= 14000

(d)

DELETE INTO EMPLOYEE HAVING SALARY >= 14000

Answer:

Option (a)

32.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

DELETE ALL THE EMPLOYEES WHO BELONGS TO ‘RAJKOT’ CITY.

(a)

DELETE FROM EMPLOYEE WHERE CITY IS 'RAJKOT'

(b)

DELETE FROM EMPLOYEE WHOSE CITY = 'RAJKOT'

(c)

DELETE FROM EMPLOYEE WHERE CITY = 'RAJKOT'

(d)

REMOVE FROM EMPLOYEE WHERE CITY = 'RAJKOT'

Answer:

Option (c)

33.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

DELETE ALL THE EMPLOYEES WHO JOINED AFTER 1-1-2007.

(a)

DELETE FROM EMPLOYEE HAVING JOININGDATE > '2007-01-01'

(b)

DELETE FROM EMPLOYEE WHERE JOININGDATE > '2007-01-01'

(c)

DELETE FROM EMPLOYEE WHERE JOININGDATE >= '2007-01-01'

(d)

DELETE FROM EMPLOYEE WHERE JOININGDATE < '2007-01-01'

Answer:

Option (b)

34.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

DELETE ALL THE RECORDS IN WHICH EMPLOYEE NAME STARTS WITH ‘B’.

(a)

DELETE FROM EMPLOYEE WHERE EMPNAME LIKE 'B_'

(b)

DELETE FROM EMPLOYEE WHERE EMPNAME LIKE '%B'

(c)

DELETE FROM EMPLOYEE WHERE EMPNAME LIKE '%B%'

(d)

DELETE FROM EMPLOYEE WHERE EMPNAME LIKE 'B%'

Answer:

Option (d)

35.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

DELETE ALL THE RECORDS OF EMPLOYEE TABLE. (USE TRUNCATE)

(a)

TRUNCATE TABLE EMPLOYEE

(b)

TRUNCATE TABLE WHOSE NAME IS EMPLOYEE

(c)

TRUNCATE EMPLOYEE TABLE 

(d)

TRUNCATE EMPLOYEE

Answer:

Option (a)

36.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

REMOVE EMPLOYEE TABLE. (USE DROP)

(a)

DROP TABLE WHOSE NAME IS EMPLOYEE

(b)

DROP TABLE EMPLOYEE

(c)

DROP EMPLOYEE

(d)

DROP EMPLOYEE TABLE 

Answer:

Option (b)

37.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

FIND ALL END OF MONTH OF DATE FOR JOININGDATE.

(a)

SELECT EOM(JOININGDATE) FROM EMPLOYEE

(b)

SELECT ENDOFMONTH(JOININGDATE) FROM EMPLOYEE

(c)

SELECT EOMONTH(JOININGDATE) FROM EMPLOYEE

(d)

SELECT MONTHEND(JOININGDATE) FROM EMPLOYEE

Answer:

Option (c)

38.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

FIND DIFFERENCE OF JOININGDATE INFORM OF MONTH WITH REFERENCE TO TODAY’S DATE.

(a)

SELECT DATEDIFFERENCE (MONTH, JOININGDATE, GETDATE ()) FROM EMPLOYEE

(b)

SELECT DATEDIFF (MONTH, JOININGDATE, GETDATE ()) FROM EMPLOYEE

(c)

SELECT DIFFERENCEOFDATE (MONTH, JOININGDATE, GETDATE ()) FROM EMPLOYEE

(d)

SELECT DATEDIFFERENCE (JOININGDATE, GETDATE (), MONTH) FROM EMPLOYEE

Answer:

Option (b)

39.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

FIND DAY, MONTH & YEAR OF JOINING DATE WITH EMPLOYEE NUMBER.

(a)

SELECT EMPNO, DAY(JOININGDATE) "DAY", MONTH(JOININGDATE) "MONTH", YEAR(JOININGDATE) "YEAR" FROM EMPLOYEE

(b)

SELECT EMPNO, DAYOF(JOININGDATE) "DAY", MONTHOF(JOININGDATE) "MONTH", YEAROF(JOININGDATE) "YEAR" FROM EMPLOYEE

(c)

SELECT EMPNO, (DAY, JOININGDATE) "DAY", (MONTH, JOININGDATE) "MONTH", (YEAR, JOININGDATE) "YEAR" FROM EMPLOYEE

(d)

SELECT EMPNO, DAY(JOININGDATE) "DAY", MONTH(JOININGDATE) "MONTH", YEAR(JOININGDATE) "YEAR" INTO EMPLOYEE

Answer:

Option (a)

40.

Write SQL statements (Query) for following tables:

Employee(EmpNo, EmpName, JoiningDate, Salary, City)

FIND ALL THE RECORDS IN WHICH DIFFERENCE OF JOININGDATE WITH TODAY’S DATE IS NOT MORE THAN 35.

(a)

SELECT DATEDIFF (MONTH, JOININGDATE, GETDATE ()) FROM EMPLOYEE HAVING DATEDIFF (MONTH, JOININGDATE, GETDATE ()) < 35

(b)

SELECT DATEDIFF (MONTH, JOININGDATE, GETDATE ()) FROM EMPLOYEE WHOSE DATEDIFF (MONTH, JOININGDATE, GETDATE ()) < 35

(c)

SELECT DATEDIFF (MONTH, JOININGDATE, GETDATE ()) FROM EMPLOYEE WHERE DATEDIFF (MONTH, JOININGDATE, GETDATE ()) < 35

(d)

SELECT DATEDIFFINMONTH (MONTH, JOININGDATE, GETDATE ()) FROM EMPLOYEE WHERE DATEDIFF (MONTH, JOININGDATE, GETDATE ()) < 35

Answer:

Option (c)

Showing 31 to 40 out of 68 Questions