This quiz works best with JavaScript enabled. Home > Cbse > Class 12 > Science > Computer Science > Class 12 Computer Science Chapter 4 Structured Query Language (Sql) – Quiz 2 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 4 Structured Query Language (Sql) Quiz 2 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is wrong with the following code:SELECT * FROM movies WHERE genre = comedy AND year < 2016 ORDER BY year DESC; A) Comedy should have single quotes around it. B) AND should be lower case. C) Movies should be capitalized. D) No changes should be made. Show Answer Correct Answer: A) Comedy should have single quotes around it. 2. ..... Keyword is used with special pattern in the expression to search for a matching string in the character field. A) GOOGLE. B) LIKE. C) MICROSOFT. D) SQL. Show Answer Correct Answer: B) LIKE. 3. Identify if there is an error in the SQL UPDATE statement below:UPDATE Employee ..... details SET Employee ..... details.Lastname = 'THANTRA', Employee ..... details.Salary = '3600' WHERE Employee ..... details.ID =8; A) No errors. B) ;. C) Spelling error. D) ( ). E) [ ]. Show Answer Correct Answer: A) No errors. 4. Which command is used to change the data type of a field in a table? A) Modify field. B) Change type. C) Update field. D) Alter table. Show Answer Correct Answer: D) Alter table. 5. Using which word allows you to specify that only one of a series of conditions needs to be met in a query filter? A) And. B) Maybe. C) If. D) Or. Show Answer Correct Answer: D) Or. 6. SELECT MAX(price)FROM PRODUCTwill return how many rows? A) 1. B) 0. C) As many rows that are in the table. D) 2. Show Answer Correct Answer: A) 1. 7. Which statement is the right syntax to make a new database using command line? A) MAKE DATASET people;. B) CREATE people;. C) CREATE DATABASE people;. D) MAKE people;. Show Answer Correct Answer: C) CREATE DATABASE people;. 8. Which SQL statement would add a record to the database? A) INSERT ('SMI01', 'M Smith', '[email protected]', '01224123456') INTO Designer. B) INSERT VALUES ('SMI01', 'M Smith', '[email protected]', 01224123456') INTO Designer. C) INSERT Designer INTO VALUES (" SMI01', 'M Smith', '[email protected]', '01224123456'). D) INSERT INTO Designer VALUES ('SMI01', 'M Smith', '[email protected]', '01224123456'). Show Answer Correct Answer: D) INSERT INTO Designer VALUES ('SMI01', 'M Smith', '[email protected]', '01224123456'). 9. A primary key can be NULL in the table? TRUE or FALSE A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: B) FALSE. 10. What does the SQL statement 'DELETE FROM world WHERE population > 10000000' do? A) Updates records in the 'world' table. B) Deletes records from the 'world' table if their population is larger than 10 million. C) Inserts new records into the 'world' table. D) Retrieves data from the 'world' table. Show Answer Correct Answer: B) Deletes records from the 'world' table if their population is larger than 10 million. 11. What is a record (row) in a database table? A) A single piece of data or attribute stored for all records in a table. B) A single entry in a table, consisting of data for each field within that table. C) A field that uniquely identifies each record in a table. D) A connection between two tables in a database. Show Answer Correct Answer: B) A single entry in a table, consisting of data for each field within that table. 12. What is a special value in SQL that represents missing or unknown data? A) NULL. B) *. C) %. D) ?. Show Answer Correct Answer: A) NULL. 13. Pernyataan (a) ..... dalam SQL digunakan untuk membina jadual daripada pangkalan data, manakala pernyataan (b) ..... dalam SQL digunakan untuk menghapuskan jadual daripada pangkalan data. A) CREATE b)DROP. B) ALTER TABLE b)DELETE. C) ALTER TABLE b) DROP. D) CREATE b)DELETE. Show Answer Correct Answer: A) CREATE b)DROP. 14. SQL query to find the temperature in increasing order of all cities. A) SELECT city, temperature FROM weather. B) SELECT city FROM weather ORDER BY temperature. C) SELECT city, temperature FROM weather ORDER BY city. D) SELECT city, temperature FROM weather ORDER BY temperature. Show Answer Correct Answer: C) SELECT city, temperature FROM weather ORDER BY city. 15. WHICH QUERY?defines the list of search criteria A) WHERE. B) SELECT. C) FROM. D) ORDER BY. Show Answer Correct Answer: A) WHERE. 16. The ..... consists of commands used to query or retrieve data from a database. A) Transfer Control Language. B) Data Manipulation Language. C) Data Query Language. D) Data Control Language. Show Answer Correct Answer: C) Data Query Language. 17. What is the main purpose of a relational database? A) To store data in a single table. B) To organise data into related tables and link data across tables. C) To analyse data using statistical methods. D) To provide a user interface for data entry. Show Answer Correct Answer: B) To organise data into related tables and link data across tables. 18. Which command is used to add a new field to an existing table in SQL? A) Append column. B) Insert field. C) Add field. D) Alter table. Show Answer Correct Answer: D) Alter table. 19. Which SQL command is used to select specific data from a table? A) DELETE FROM. B) UPDATE. C) INSERT INTO. D) SELECT. Show Answer Correct Answer: D) SELECT. 20. What does a NULL value represent in SQL? A) It is treated as a blank or zero. B) It is treated as a non-existent value. C) It is treated as a negative value. D) None of the above. Show Answer Correct Answer: B) It is treated as a non-existent value. 21. Select SQL command to insert values in COURSE table. A) INSERT COURSE VALUES ("DFC20203", "Database Design") INTO COURSE;. B) INSERT VALUES INTO COURSE ("DFC20203", "Database Design");. C) INSERT COURSE VALUES("DFC20203", "Database Design");. D) INSERT INTO COURSE VALUES ("DFC20203", "Database Design");. Show Answer Correct Answer: D) INSERT INTO COURSE VALUES ("DFC20203", "Database Design");. 22. Which of the following scripts will run successfully? A) SELECT customer name FROM customers;. B) SELECT FROM 'customers' 'customer name';. C) SELECT 'customer name' FROM customers ORDER BY zone WHERE cat id = 12;. D) SELECT 'customer name' FROM customers WHERE cat id = 12 ORDER BY cat id;. Show Answer Correct Answer: A) SELECT customer name FROM customers;. 23. "INSERT INTO" is the keyword used to insert data into tables. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 24. What can you do with SQL besides the commands mentioned? A) Define and create tables. B) Add, delete, and change fields in a table. C) Set up relationships between tables. D) All of the above. Show Answer Correct Answer: D) All of the above. 25. What is missing in this code? SELECT * FROM WHERE genre = 'action' ORDER BY year ASC; A) Missing an AND. B) Table name. C) Capitalize action. D) None of these. Show Answer Correct Answer: B) Table name. 26. What is the SQL keyword that reconnects rows with foreign keys with the corresponding data in the table that the foreign key points to? A) APPEND. B) CONNECT. C) JOIN. D) COUNT. E) CONSTRAINT. Show Answer Correct Answer: C) JOIN. 27. What does the SQL command 'SELECT *' do? A) Selects all fields from the table. B) Selects only the primary key field. C) Selects fields with a specific value. D) Selects fields based on a condition. Show Answer Correct Answer: A) Selects all fields from the table. 28. SQL is a ..... language designed for the retrieval and management of relational database. A) Speaking. B) Programming. C) All the above. D) None of the above. Show Answer Correct Answer: B) Programming. 29. What is the purpose of the 'like' keyword in SQL? A) To delete records from a table. B) To insert new records into a table. C) To select records based on a pattern. D) To join multiple tables. Show Answer Correct Answer: C) To select records based on a pattern. 30. Where does the CREATE Command belong? A) DML. B) DDL. C) DCL. D) None of the above. Show Answer Correct Answer: B) DDL. 31. The command to remove rows from a table 'CUSTOMER' is ..... A) DELETE FROM CUSTOMER WHERE. B) REMOVE FROM CUSTOMER. C) UPDATE FROM CUSTOMER. D) DROP FROM CUSTOMER. Show Answer Correct Answer: A) DELETE FROM CUSTOMER WHERE. 32. What is the purpose of the 'update' command in SQL? A) To modify existing records. B) To delete records from a table. C) To join multiple tables. D) To insert new records into a table. Show Answer Correct Answer: A) To modify existing records. 33. The LIMIT clause reduces the number of rows returned by a query. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 34. Differentiate between DELETE and DROP command. A) DELETE is DDL command while DROP is DML command. B) DELETE cannot use with WHERE clause while DROP can use with WHERE clause. C) DELETE is used to remove a table from the database while DROP cannot remove a table from the database. D) DELETE is used to remove a record of a table while DROP is used to remove a structure and records of a table. Show Answer Correct Answer: D) DELETE is used to remove a record of a table while DROP is used to remove a structure and records of a table. 35. .... Command withdraws the access permission given by the GRANT statement A) Delete. B) Revoke. C) Grant. D) Update. Show Answer Correct Answer: B) Revoke. 36. In order to modify data in a database we would use which SQL statement? A) Modify. B) Amend. C) Alter. D) Update. Show Answer Correct Answer: D) Update. 37. A column in a database A) Row. B) Record. C) Data. D) Field. Show Answer Correct Answer: D) Field. 38. The HAVING clause includes a predicate used to filter rows resulting from the ..... clause A) HAVING. B) SELECT. C) FROM. D) GROUP. Show Answer Correct Answer: D) GROUP. 39. What does a declarative language mean in the context of SQL? A) It expresses how something needs to be achieved. B) It expresses what needs to be achieved. C) It expresses when something needs to be achieved. D) It expresses where something needs to be achieved. Show Answer Correct Answer: B) It expresses what needs to be achieved. 40. ANSI stands for ..... A) American National System Institute. B) American Number Standard Institute. C) American National Standard Institute. D) American Net Standard Institute. Show Answer Correct Answer: C) American National Standard Institute. 41. A primary key can be set to null. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 42. ..... command restores the database to last commit state A) Commit. B) Rollback. C) Revoke. D) Savepoint. Show Answer Correct Answer: B) Rollback. 43. Which SQL function is used to count the number of rows in a SQL query? A) NUMBER(). B) COUNT(). C) COUNT(*). D) SUM(). Show Answer Correct Answer: C) COUNT(*). 44. What word is missing from the line below?SELECT * ..... CUSTOMER; A) WHERE. B) ORDER BY. C) FROM. D) SELECT. Show Answer Correct Answer: C) FROM. 45. List the Data Definition Language (DDL) command. A) INSERT, UPDATE, DROP, SELECT. B) INSERT, UPDATE, DELETE, SELECT. C) CREATE, USE, INSERT, DELETE. D) CREATE, USE ALTER, DROP. Show Answer Correct Answer: D) CREATE, USE ALTER, DROP. 46. What is the purpose of *? A) Selects ALL fields from the table. B) Selects only the first field in the table. C) Selects the last field in the table. D) Shows only the first row in the table. Show Answer Correct Answer: A) Selects ALL fields from the table. 47. Values of ..... type is enclosed in single quotes. A) Int. B) Numeric. C) Char. D) Dec. Show Answer Correct Answer: C) Char. 48. .... are instructions given by the user to the database also known as statements. A) Arguments. B) Keywords. C) Comments. D) Clauses. Show Answer Correct Answer: C) Comments. 49. Return only the customers who have ER anywhere in their last name. A) Last name LIKE "%er". B) Last name LIKE "%er%". C) Last name = "%er%". D) Last name = "%er". Show Answer Correct Answer: B) Last name LIKE "%er%". 50. Which keyword is used to add conditions to your query? A) WHERE. B) ONLYIF. C) IF. D) SELECT. Show Answer Correct Answer: A) WHERE. 51. What represents no value? A) 0. B) '' ''. C) NULL. D) N/A. Show Answer Correct Answer: C) NULL. 52. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" ends with an "a" ? A) SELECT * FROM Persons WHERE FirstName LIKE '%a'. B) SELECT * FROM Persons WHERE FirstName='a'. C) SELECT * FROM Persons WHERE FirstName LIKE 'a%'. D) SELECT * FROM Persons WHERE FirstName='%a%'. Show Answer Correct Answer: A) SELECT * FROM Persons WHERE FirstName LIKE '%a'. 53. WHICH QUERY?defines the list of tables the data will come from A) ORDER BY. B) WHERE. C) FROM. D) SELECT. Show Answer Correct Answer: C) FROM. 54. You're creating a table for a movie database.Which column should be a foreign key? A) Director id INT. B) Movie title VARCHAR(100). C) Release year INT. D) Genre VARCHAR(50). Show Answer Correct Answer: A) Director id INT. 55. What does the SQL statement 'INSERT INTO world (name, capital, population) VALUES ('Ours', 'Emerald City', 1000000)' do? A) Retrieves data from the 'world' table. B) Inserts a new record with the given values into the 'world' table. C) Updates records in the 'world' table. D) Deletes records from the 'world' table. Show Answer Correct Answer: B) Inserts a new record with the given values into the 'world' table. 56. Write a code for the following:Return the names and imdb ..... ratings of all movies with 'day' in the name. A) SELECT * FROM movies WHERE name LIKE 'day';. B) RETURN name, imdb rating FROM movies WHERE name LIKE '%day%';. C) SELECT name, imdb rating FROM movies WHERE name LIKE '%day%';. D) SELECT * FROM movies WHERE imdb rating AND name LIKE '%day%';. Show Answer Correct Answer: C) SELECT name, imdb rating FROM movies WHERE name LIKE '%day%';. 57. What is the command used to delete entire tables in SQL? A) Drop table. B) Delete table. C) Erase table. D) Remove table. Show Answer Correct Answer: A) Drop table. 58. .... ensure database integrity . A) Arguments. B) Variable. C) Constraints. D) Clauses. Show Answer Correct Answer: C) Constraints. 59. A column of type CHAR cannot be indexed. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 60. Which statement allows us to add a record to a table? A) Add Into. B) Insert Into. C) Update To. D) Add To. Show Answer Correct Answer: B) Insert Into. ← PreviousNext →Related QuizzesScience QuizzesClass 12 QuizzesClass 12 Computer Science Chapter 4 Structured Query Language (Sql) Quiz 1Class 12 Computer Science Chapter 4 Structured Query Language (Sql) Quiz 3Class 12 Computer Science Chapter 1 Data Structures Using Python QuizClass 12 Computer Science Chapter 2 Advanced Python Programming QuizClass 12 Computer Science Chapter 3 Database Management Systems QuizClass 12 Computer Science Chapter 5 Networking And Cyber Security QuizClass 12 Computer Science Chapter 6 Boolean Algebra And Logic Gates Quiz 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books