1. What is the full form of SQL?
a. Structured Query List
b. Structured Query Language
c. Sample Query Language
d. None of these.
2. Which of the following is the full form of DDL?
a. Data Definition Language
b. Data Derivation Language
c. Dynamic Data Language
d. Detailed Data Language
3. Which of the following is not a DDL command?
a. TRUNCATE
b. ALTER
c. CREATE
d. UPDATE
4. Which of the following commands are a part of Data Control Language?
a. Revoke
b. Grant
c. Both A and B
d. None of the above
5. Which of the following are TCL commands?
a. COMMIT and ROLLBACK
b. UPDATE and TRUNCATE
c. SELECT and INSERT
d. GRANT and REVOKE
6. What command is used to create a new table in SQL?
a. CREATE TABLE
b. BUILD TABLE
c. GENERATE TABLE
d. None of the above
7. Which command is used to change the definition of a table in SQL?
a. CREATE
b. UPDATE
c. ALTER
d. SELECT
8. Which SQL command is used to add a new record to a table?
a. SELECT
b. DELETE
c. UPDATE
d. INSERT
9. What command do you use to add new data to a table?
a. INSERT
b. APPEND
c. ADDTO
d. SELECT
10. What does the UPDATE command in SQL do?
a. Deletes a record
b. Modifies an existing record
c. Adds a new record
d. Retrieves data
11. What command do you use to make changes to existing data in a table?
a. MODIFY
b. CHANGE
c. SELECT
d. UPDATE
12. Which statement is used to delete all rows in a table?
a. DELETE
b. REMOVE
c. DROP
d. TRUNCATE
13. Which SQL statement is used to retrieve data from a database?
a. UPDATE
b. DELETE
c. INSERT
d. SELECT
15. What does the DROP command do in SQL?
a. Adds a new row to a table
b. Deletes an existing table
c. Modifies a table
d. Creates a new table
16. The command to remove rows from a table ‘CUSTOMER’ is:
a. REMOVE FROM CUSTOMER ;
b. DROP FROM CUSTOMER ;
c. DELETE FROM CUSTOMER;
d. UPDATE FROM CUSTOMER ;
17. Which part of the SQL query specifies the table or tables that contain the data you wish to display in the query results?
a. SELECT clause
b. WHERE clause
c. WITHIN clause
d. FROM clause
18. In SQL, what is the purpose of the WHERE clause in a DELETE statement?
a. Specifies which database to use
b. Specifies which table to delete from
c. Specifies which records to delete
d. Specifies how to order the records
19. In SQL, what is the difference between CHAR and VARCHAR data types?
a. CHAR is fixed length, VARCHAR is variable length
b. CHAR is variable length, VARCHAR is fixed length
c. No difference
d. VARCHAR is used only for numeric data
20. Which operator do you use in the WHERE clause when you want to include a wildcard?
a. LIKE
b. AS
c. BETWEEN
d. UNION
21. If we have not specified ASC or DESC after a SQL ORDER BY clause, the following is used by default
a. DESC
b. ASC
c. There is no default value
d. None of the mentioned
22. What does the following statement in SQL do?
DROP TABLE student;
a. Deletes a table called student.
b. Creates a table called student.
c. Check if there is a table called student.
d. None of the above.
23. What does the following code snippet do?
ALTER
TABLE STUDENT
ADD(ADDRESS VARCHAR2(
20));
a. Adds a column called ADDRESS in the table student.
b. Checks if a column called ADDRESS is present in the table student.
c. Invalid Syntax
d. None of the above
24. What does the following code snippet do?
DELETE
FROM STUDENTS
WHERE AGE
=
16;
ROLLBACK;
a. Performs an undo operation on the delete operation.
b. Deletes the rows from the table where AGE = 16
c. Deletes the entire table
d. None of the above
25. How many Primary keys can have in a table?
a. Only 1
b. Only 2
c. Depends on no of Columns
d. Depends on DBA
26. ______ is NOT a type of constraint in SQL language?
a. FOREIGN KEY
b. PRIMARY KEY
c. UNIQUE
d. ALTERNATE KEY
27. Which of the following is not a valid aggregate function?
a. COUNT
b. COMPUTE
c. SUM
d. MAX
28. Which of the following is not a valid aggregate function?
a. count()
b. Sum()
c. Avg()
d. None of the above
29. Which function calculates the number of entries in a table?
a. COUNT
b. SUM
c. MAX
d. MIN
30. Which statement is used to get all data from the student table whose name starts with m?
a. SELECT * FROM student WHERE name LIKE ‘%m%’;
b. SELECT * FROM student WHERE name LIKE ‘m%’;
c. SELECT * FROM student WHERE name LIKE ‘m’;
d. SELECT * FROM student WHERE name LIKE ‘%m’;
31. Which of the following statement is correct to display all the cities with the condition, temperature, and humidity whose humidity is in the range of 60 to 75 from the ‘weather’ table?
a. SELECT * FROM weather WHERE humidity IN (60 to 75)
b. SELECT * FROM weather WHERE humidity BETWEEN 60 AND 75
c. SELECT * FROM weather WHERE humidity NOT IN (60 AND 75)
d. SELECT * FROM weather WHERE humidity NOT BETWEEN 60 AND 75
32. How can you change “Rahul” into “Rajiv” in the “FirstName” column in the Students table?
a. UPDATE Student SET FirstName = ‘Rahul’ INTO FirstName = ‘Rajiv’
b. MODIFY Students SET FirstName = ‘Rajiv’ WHERE FirstName = ‘Rahul’
c. MODIFY Students SET FirstName = ‘Rahul’ INTO FirstName = ‘Rajiv’
d. UPDATE Students SET FirstName = ‘Rajiv’ WHERE FirstName = ‘Rahul’
33. What does the ROLLBACK command do in a transaction?
a. Starts a new transaction
b. Saves the transaction changes
c. Restores the database to the state before the transaction started
d. Grants user permissions
34. When used after the word SELECT, which symbol indicates that you want to include all fields in the query results in the order in which you described them to the DBMS when you created the table?
a. *
b. &
c. #
d. $
35. While not always required, how should you end an SQL command?
a. with a comma (,)
b. with a period (.)
c. with a colon (:)
d. with a semicolon (;)
36. ALTER TABLE Students ADD COLUMN Email varchar(50);
what is missing for this statement to be correct?
a. ADD COLUMN
b. Email
c. varchar(50)
d. All Correct
37. Which of the following are valid SQL constraints?
a. NOT NULL
b. CHECK
c. UNIQUE
d. All of the above
38. Which SQL constraint do we use to set some value to a field whose value has not been added explicitly?
a. UNIQUE
b. NOT NULL
c. DEFAULT
d. CHECK
39. Which of the following SQL functions is commonly used to extract a specific portion of a string.
a. UPPER()
b. SUBSTR()
c. ADDSTRING()
d. CONCAT()
40. Which of the following commands are used to put a restriction on the number of rows returned from a query?
a. LIMIT
b. LIKE
c. WHERE
d. GROUP BY