SQL MCQ Exam: Trivia Quiz!

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Abdul
A
Abdul
Community Contributor
Quizzes Created: 8 | Total Attempts: 24,858
| Attempts: 1,968 | Questions: 25
Please wait...
Question 1 / 25
0 %
0/100
Score 0/100
1. Which SQL statement is used to update data in a Table?

Explanation

The correct answer is UPDATE. The UPDATE statement is used in SQL to modify or update existing data in a table. It allows you to change the values of one or more columns in a specific row or multiple rows of a table. This statement is essential for making changes to the data stored in a database table.

Submit
Please wait...
About This Quiz
SQL MCQ Exam: Trivia Quiz! - Quiz

Dive into the SQL MCQ Exam: Trivia Quiz! Designed to test and enhance your SQL skills, this quiz covers essential operations like SELECT, UPDATE, and INSERT. Ideal for... see morelearners aiming to master database management through practical SQL query scenarios. see less

2. With SQL, how do you select all the columns from a table named "Persons"?              

Explanation

To select all the columns from a table named "Persons" in SQL, you would use the syntax "SELECT * FROM Persons". The asterisk (*) is a wildcard character that represents all columns in the table. By using this query, you will retrieve all the data from every column in the "Persons" table.

Submit
3. Which SQL statement is used to extract data from a Table?

Explanation

The SQL statement "SELECT" is used to extract data from a table. It allows you to retrieve specific columns or rows from a table based on specified conditions. By using the SELECT statement, you can retrieve data from one or multiple tables, apply filters, sort the results, and perform other operations to manipulate the data.

Submit
4. With SQL, how can you insert a new record into the "Persons" table?

Explanation

The correct answer is "INSERT INTO Persons VALUES ('Jimmy', 'Jackson')". This is the correct syntax for inserting a new record into the "Persons" table in SQL. The VALUES keyword is used to specify the values to be inserted, and they are enclosed in parentheses and separated by commas. The INSERT INTO statement is used to indicate the table where the record should be inserted.

Submit
5. Which  is not used into SQL=,<>,> ,<,>=,<=,>>>  

Explanation

The correct answer is only >>> not used. This is because the >>> symbol is not a valid operator in SQL. SQL uses =, , >, =, and >> is not included in this list. Therefore, only >>> is not used in SQL.

Submit
6. With SQL, how do you select a column named "FirstName" from a table named "Persons"?                  

Explanation

To select a column named "FirstName" from a table named "Persons" in SQL, you would use the query "SELECT FirstName FROM Persons". This query specifies the column "FirstName" that you want to select from the table "Persons".

Submit
7. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

Explanation

The correct answer is "INSERT INTO Persons (LastName) VALUES ('Olsen')". This is the correct syntax for inserting a new row into the "Persons" table with the value "Olsen" in the "LastName" column. The keyword "INSERT INTO" is used to specify the table to insert into, followed by the column names in parentheses. The keyword "VALUES" is used to specify the values to be inserted, with each value enclosed in single quotes.

Submit
8. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?

Explanation

The correct answer is "DELETE FROM Persons WHERE FirstName = 'Peter'". This statement is the correct syntax for deleting records from the "Persons" table where the "FirstName" column is equal to "Peter".

Submit
9. The following are clauses of the SELECT statement:1. WHERE 2. FROM 3. ORDER BY In which order should they appear in a query? 

Explanation

The correct answer is 2, 1, 3. In a SELECT statement, the FROM clause should appear first to specify the table or tables from which the data will be retrieved. The WHERE clause should come next to filter the data based on specified conditions. Finally, the ORDER BY clause should appear last to sort the retrieved data in a specified order.

Submit
10. Which of the following statements contains an error?

Explanation

The error in the statement "SELECT empid WHERE empid = 56949 AND lastname = ‘SMITH’;" is that it is missing the "FROM" keyword. In a SELECT statement, the syntax requires specifying the table from which the data is being selected. In this case, the correct statement should be "SELECT empid FROM emp WHERE empid = 56949 AND lastname = ‘SMITH’;".

Submit
11. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?                

Explanation

The correct answer is "UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'". This is the correct SQL statement to update the value of the LastName column from "Hansen" to "Nilsen" in the Persons table. The UPDATE keyword is used to modify data in a table, followed by the table name (Persons) and the SET keyword to specify the column to be updated. The WHERE clause is used to specify the condition that must be met for the update to occur, in this case, the LastName must be "Hansen".

Submit
12. Which single-row function could you use to return a specific portion of a character string? 

Explanation

SUBSTR is the correct answer because it is a single-row function that can be used to return a specific portion of a character string. It allows you to extract a substring from a larger string by specifying the starting position and the length of the substring you want to extract.

Submit
13. Which statement would change all occurrences of the string 'NESS' to the string 'SUN' in the DESCRIPTION column of the VENDOR table? 

Explanation

The correct answer is SELECT REPLACE(description, 'NESS', 'SUN') FROM vendor. This statement uses the REPLACE function to replace all occurrences of the string 'NESS' with the string 'SUN' in the DESCRIPTION column of the VENDOR table.

Submit
14. You query the table with this commandSELECT nameFROM employeeWHERE name LIKE '_a%'; Which names are displayed? 

Explanation

The query is searching for names that start with any character followed by "a" and any number of characters after that. So the names displayed will be those that have "a" as the second character.

Submit
15. Which of the following are parts of a SELECT statement? Choose all that apply. 

Explanation

The SELECT statement is used in SQL to retrieve data from a database. It consists of various components, including the FROM clause and the WHERE clause. The FROM clause is used to specify the table or tables from which the data is being retrieved. The WHERE clause is used to specify the conditions that the data must meet in order to be included in the result set. Therefore, both FROM and WHERE are essential parts of a SELECT statement. On the other hand, DEFINE and DESELECT are not valid components of a SELECT statement, making them incorrect choices.

Submit
16. Choose correct syntax to insert values into r4r_team table 

Explanation

The correct answer is "INSERT INTO r4r_team (id, username, exp) VALUES (1, ‘r4r01’, ‘2’)" because it follows the correct syntax for inserting values into the r4r_team table. The INSERT INTO statement is used to add data to a table, followed by the table name (r4r_team) and the column names (id, username, exp) in parentheses. The VALUES keyword is used to specify the values to be inserted, which are provided in the same order as the column names, also in parentheses. The values 1, 'r4r01', and '2' are inserted into the id, username, and exp columns respectively.

Submit
17. Which Operators combine the results of two-component queries into a single result?

Explanation

Set operators combine the results of two-component queries into a single result. These operators allow you to perform operations such as union, intersection, and difference on sets of data. By using set operators, you can merge or compare the results of multiple queries, resulting in a consolidated and meaningful output. Therefore, the correct answer is Set Operators.

Submit
18. ______________used to Create, Manage database objects in the database.

Explanation

DDL stands for Data Definition Language. It is used to create and manage database objects in the database. DDL statements are used to define the structure of the database, including creating tables, indexes, views, and other database objects. DDL statements are not used to manipulate or retrieve data, but rather to define the structure and organization of the database. Examples of DDL statements include CREATE, ALTER, and DROP.

Submit
19. Which command will delete all data from a table and will not write to the rollback segment?

Explanation

The correct answer is "Truncate". The Truncate command is used to delete all data from a table without writing it to the rollback segment. It is a faster and more efficient way to delete all data compared to the Delete command. Truncate also resets the high water mark of the table, freeing up space in the table for future use.

Submit
20. You issue the following query: SELECT empno, ename FROM emp WHERE empno = 7782 OR empno = 7876;         Which other operator can replace the OR condition in the WHERE clause

Explanation

The IN operator can replace the OR condition in the WHERE clause. It allows you to specify multiple values in a single query, so instead of using multiple OR conditions, you can use the IN operator followed by a list of values to match against the empno column. This makes the query shorter and more concise.

Submit
21. Roll Back segment is not used in case of:

Explanation

The roll back segment is not used in any of the mentioned cases: DCL (Data Control Language), DDL (Data Definition Language), and DQL (Data Query Language). DCL statements like GRANT and REVOKE do not require roll back segments as they do not modify data. DDL statements like CREATE and ALTER also do not use roll back segments as they only modify the structure of the database. DQL statements like SELECT do not require roll back segments as they only retrieve data and do not modify it. Therefore, the correct answer is "All of the above."

Submit
22. How many columns are retrieved from this query: SELECT address1||','||address2||','||address2 "Address" FROM  employee;

Explanation

The given query retrieves three columns from the employee table. The SELECT statement concatenates the address1, address2, and address2 columns using the || operator and adds a comma between each value. The resulting column is aliased as "Address". Therefore, the query returns three columns: address1, address2, and the concatenated column "Address".

Submit
23. How does a TRUNCATE TABLE statement differ from an unrestricted DELETE? Select all that apply.

Explanation

The correct answer is "Using TRUNCATE all the values in the table will be deleted but not the structure whereas as In Delete a particular row can be deleted but not the structure." This answer correctly explains the difference between a TRUNCATE TABLE statement and an unrestricted DELETE. TRUNCATE TABLE deletes all the values in the table but keeps the structure intact, while DELETE allows for the deletion of specific rows but does not affect the structure of the table.

Submit
24. Which statement successfully adds a new column ORDER_DATE to the table ORDERS?

Explanation

This statement successfully adds a new column ORDER_DATE to the table ORDERS. It uses the correct syntax for adding a column to a table in SQL, which is "ALTER TABLE table_name ADD column_name data_type;". In this case, the table name is ORDERS, the column name is ORDER_DATE, and the data type is DATE.

Submit
25. Which of the constraint can be defined at the table?

Explanation

A default constraint can be defined at the table in a database. This constraint specifies a default value for a column if no value is provided during an insert operation. It ensures that the column always has a value, even if it is not explicitly provided. This can be useful for columns that have a commonly used default value, such as a date or a specific string.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 22, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 15, 2017
    Quiz Created by
    Abdul
Cancel
  • All
    All (25)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which SQL statement is used to update data in a Table?
With SQL, how do you select all the columns from a table named...
Which SQL statement is used to extract data from a Table?
With SQL, how can you insert a new record into the "Persons"...
Which  is not used into SQL=,<>,>...
With SQL, how do you select a column named "FirstName" from...
With SQL, how can you insert "Olsen" as the...
With SQL, how can you delete the records where the...
The following are clauses of the SELECT statement:1. WHERE 2. FROM 3....
Which of the following statements contains an error?
How can you change "Hansen" into "Nilsen" in the...
Which single-row function could you use to return a specific portion...
Which statement would change all occurrences of the string...
You query the table with this commandSELECT nameFROM employeeWHERE...
Which of the following are parts of a SELECT statement? Choose all...
Choose correct syntax to insert values into r4r_team table 
Which Operators combine the results of two-component queries into a...
______________used to Create, Manage database objects in the database.
Which command will delete all data from a table and will not write to...
You issue the following query:...
Roll Back segment is not used in case of:
How many columns are retrieved from this query:...
How does a TRUNCATE TABLE statement differ from an unrestricted...
Which statement successfully adds a new column ORDER_DATE to the table...
Which of the constraint can be defined at the table?
Alert!

Advertisement