Structured Query Language (GATE - CS)
Comprehensive SQL quiz covering views, operators, joins, constraints, and DML for GATE CS exam preparation
Questions
Which of the following statements is not correct about SQL view?
- It can view the data without storing the data into the object.
- It can hide the complexity of data.
- It restricts the access of a table so that nobody can insert the rows into the table.
- It can use DML operations on the views.
- It joins two or more tables and shows it as one object to a user.
Which of the following datatypes is/are used to convert a result value into another type?
- convert
- cast
- modify
- alter type
- All of the above
In SQL server, which of the following operators is/are used to combine two strings in the results?
- CONCAT(), AND
- CONCAT(), +
- CONCAT(), ||
- CONCAT()
- CONCAT(), -
In contemporary databases, the top level of the hierarchy consists of which of the following?
- Catalogs
- Schemas
- Environment
- 1
- 2
- 3
- 1 and 3
- 1, 2 and 3
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
- employee’s salary is greater than 4999
- employee’s department is accounts
- employee’s department is accounts and employee’s salary is greater than 5000
- employee’s department is accounts and employee’s salary is greater than 4999
- total salary of employee is zero
Which SQL operator is used to test whether the sub query or inner query has any tuples?
- SQL intersect
- SQL union
- SQL in
- SQL join
- SQL exists
Which of the following statements contains an error?
- Select * from employee where empid = 505
- Select empid from employee where empname = John
- Select empid from employee
- Select empid where empid = 509 and lname = John
- Select * from employee where empid = 305
The SQL Join statement which returns all the rows when there is a match in one of the tables, is
- SQL Inner Join
- SQL Left Outer Join
- SQL Right Outer Join
- SQL Full Outer Join
- SQL Upper Join
Select the SQL statement which is used to delete the data inside a table.
- SQL DELETE
- SQL DROP TABLE
- SQL DROP INDEX
- SQL DROP DATABASE
- SQL TRUNCATE TABLE
Which database does not support ISNULL () function?
- SQL server
- MS access
- Oracle
- MySQL
- D-link
The SQL statement which is used to delete a particular column in an existing table is
- SQL alter
- SQL modify
- SQL drop
- SQL delete
- SQL update
Consider the query:
(select customer-name from depositor) union (select customer-name from borrower)
The output will
- return all customer names without duplicate values
- return all customer names from the depositor table
- return all customer names from borrower table
- return all customer names if names available in depositor table match with borrower table
- return all customer names with duplicate values
SQL is a set-based, ________________ query language and not an imperative language.
- procedural
- non-procedural
- imperative
- non-imperative
- None of these
The SQL Data Manipulation Language includes a query language based on
- relational algebra
- tuple relational calculus
- domain relational calculus
- Both 1 and 2
- Both 1 and 3
Select the SQL statement which is used to find the employee city name starting with “mi”.
- Select * from tblemployee where city like ‘mi’
- Select * from tblemployee where city ‘mi%’
- Select * from tblemployee where city ‘‘mi%’’
- Select * from tblemployee where city like ‘mi%’
- Select * from tblemployee where city like ‘%mi’