Structured Query Language (GATE - CS)

Comprehensive SQL quiz covering views, operators, joins, constraints, and DML for GATE CS exam preparation

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following statements is not correct about SQL view?

  1. It can view the data without storing the data into the object.
  2. It can hide the complexity of data.
  3. It restricts the access of a table so that nobody can insert the rows into the table.
  4. It can use DML operations on the views.
  5. It joins two or more tables and shows it as one object to a user.
Question 2 Multiple Choice (Single Answer)

Which of the following datatypes is/are used to convert a result value into another type?

  1. convert
  2. cast
  3. modify
  4. alter type
  5. All of the above
Question 3 Multiple Choice (Single Answer)

In SQL server, which of the following operators is/are used to combine two strings in the results?

  1. CONCAT(), AND
  2. CONCAT(), +
  3. CONCAT(), ||
  4. CONCAT()
  5. CONCAT(), -
Question 4 Multiple Choice (Single Answer)

In contemporary databases, the top level of the hierarchy consists of which of the following?

  1. Catalogs
  2. Schemas
  3. Environment
  1. 1
  2. 2
  3. 3
  4. 1 and 3
  5. 1, 2 and 3
Question 5 Multiple Choice (Single Answer)

Create table employee salary (empid int, fname varchar (30), lname varchar (30), dept varchar (30), salary varchar (10), constraint chk_employee salary check (dept=’Accounts’ AND salary>=5000)). It allows to insert values if

  1. employee’s salary is greater than 4999
  2. employee’s department is accounts
  3. employee’s department is accounts and employee’s salary is greater than 5000
  4. employee’s department is accounts and employee’s salary is greater than 4999
  5. total salary of employee is zero
Question 6 Multiple Choice (Single Answer)

Which SQL operator is used to test whether the sub query or inner query has any tuples?

  1. SQL intersect
  2. SQL union
  3. SQL in
  4. SQL join
  5. SQL exists
Question 7 Multiple Choice (Single Answer)

Which of the following statements contains an error?

  1. Select * from employee where empid = 505
  2. Select empid from employee where empname = John
  3. Select empid from employee
  4. Select empid where empid = 509 and lname = John
  5. Select * from employee where empid = 305
Question 8 Multiple Choice (Single Answer)

The SQL Join statement which returns all the rows when there is a match in one of the tables, is

  1. SQL Inner Join
  2. SQL Left Outer Join
  3. SQL Right Outer Join
  4. SQL Full Outer Join
  5. SQL Upper Join
Question 9 Multiple Choice (Single Answer)

Select the SQL statement which is used to delete the data inside a table.

  1. SQL DELETE
  2. SQL DROP TABLE
  3. SQL DROP INDEX
  4. SQL DROP DATABASE
  5. SQL TRUNCATE TABLE
Question 10 Multiple Choice (Single Answer)

Which database does not support ISNULL () function?

  1. SQL server
  2. MS access
  3. Oracle
  4. MySQL
  5. D-link
Question 11 Multiple Choice (Single Answer)

The SQL statement which is used to delete a particular column in an existing table is

  1. SQL alter
  2. SQL modify
  3. SQL drop
  4. SQL delete
  5. SQL update
Question 12 Multiple Choice (Single Answer)

Consider the query:

(select customer-name from depositor) union (select customer-name from borrower)

The output will

  1. return all customer names without duplicate values
  2. return all customer names from the depositor table
  3. return all customer names from borrower table
  4. return all customer names if names available in depositor table match with borrower table
  5. return all customer names with duplicate values
Question 13 Multiple Choice (Single Answer)

SQL is a set-based, ________________ query language and not an imperative language.

  1. procedural
  2. non-procedural
  3. imperative
  4. non-imperative
  5. None of these
Question 14 Multiple Choice (Single Answer)

The SQL Data Manipulation Language includes a query language based on

  1. relational algebra
  2. tuple relational calculus
  3. domain relational calculus
  4. Both 1 and 2
  5. Both 1 and 3
Question 15 Multiple Choice (Single Answer)

Select the SQL statement which is used to find the employee city name starting with “mi”.

  1. Select * from tblemployee where city like ‘mi’
  2. Select * from tblemployee where city ‘mi%’
  3. Select * from tblemployee where city ‘‘mi%’’
  4. Select * from tblemployee where city like ‘mi%’
  5. Select * from tblemployee where city like ‘%mi’