These SQL multiple-choice questions and their answers will help you strengthen your grip on the subject of SQL. You can prepare for an upcoming exam or job interview with these SQL MCQs.
So scroll down and start answering.
A. .dataquery
B. .sql
C. .sequel
D. .query
A. grouping
B. primary
C. summary
D. aggregate
A. before FROM
B. before ORDER BY
C. before SELECT
D. before WHERE
A. It is not possible to violate a foreign key constraint. The modification is rejected
B. The DBMS throw an error but implements the violated changes
C. The value is cascaded
D. The value is set to NULL
A. outermost
B. last
C. innermost
D. first
A. SELECT, FROM, WHERE, HAVING, ORDER BY, GROUP BY
B. SELECT, FROM, WHERE, HAVING, GROUP BY, ORDER BY
C. SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING
D. SELECT, FROM, GROUP BY, HAVING, ORDER BY, WHERE
E. SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY
A. LIMIT 4, 5
B. LIMIT 0, 4
C. LIMIT 5, 4
D. LIMIT 0, 5
A. Declare cursor > Open cursor > Fetch row from the cursor > Process fetched row > Close cursor > Deallocate cursor
B. Declare cursor > Open cursor > Fetch row from the cursor > Process fetched row > Deallocate cursor > Close cursor
C. Open cursor > Fetch row from the cursor > Process fetched row > Close cursor > Deallocate cursor
D. Open cursor > Fetch row from the cursor > Process fetched row > Deallocate cursor > Close cursor
A. 0 or more records from tableA; all records from tableB
B. All records from tableA; all records from tableB
C. All records from tableA; 0 or more records from tableB
D. Only records where key is in both tableA and tableB
A. percent (%)
B. at (@)
C. ampersand (&)
D. asterisk (*)
A. Cartesian product
B. primary key
C. table constraint
D. mega join
E. null value
A. UNION ALL is an invalid command
B. UNION ALL will only select distinct values
C. UNION ALL will not eliminate duplicate rows
D. UNION ALL will include null values
A. null
B. float
C. smallint
D. integer
E. character
A. Returns the output from the query before and the query after the operator excluding duplicates.
B. Returns the output from the query before and the query after the operator including duplicates.
C. Concatenates all of the columns in the table specified with an optional user defined delimiter between.
D. Joins all of the tables that have a primary or foreign key relationship to the specified table.
A. TOTAL
B. DUPLICATES_ALLOWED
C. EVERY
D. ALL
A. null values
B. columns
C. rows
D. duplicate values
A. organic list
B. index
C. stored procedure
D. table schema
E. tuple
A. HAVING
B. ORDER BY
C. LIMIT
D. WHERE
E. SELECT
A. Return the first row from table
B. Return all the rows from table
A. GROUP BY, FULL OUTER JOIN, ORDER BY
B. HAVING, WHERE, ORDER BY
C. WHERE, FULL OUTER JOIN, HAVING
D. SELECT, OUTER JOIN, GROUP BY
E. SELECT, FULL OUTER JOIN, ORDER BY
A. It is a proprietary version of SQL used by Oracle
B. It is a proprietary version of SQL developed by MySQL
C. It is a proprietary version of SQL developed for Visual Studio
D. It is a proprietary version of SQL developed by Microsoft
E. An open source version of SQL
A. SELECT first_name FROM PERSON WHERE last_name = NULL
B. SELECT first_name FROM PERSON WHERE EXISTS NULL last_name
C. SELECT first_name FROM PERSON WHERE last_name IS NULL
D. SELECT first_name FROM PERSON WHERE last_name AS NULL
A. DROP TABLE orders
B. SANITIZE orders
C. TRUNCATE orders
D. REMOVE ROWS FROM orders
A. OUTER
B. FULL
C. INNER
D. FADE
E. CROSS
A. HAVING
B. SORT
C. GROUPS
D. MINIMIZE
E. FILTER
A. CHAR
B. TEXTCHAR
C. NVARCHAR
D. NCHAR
E. VARCHAR
A. JOIN()
B. CONCAT()
C. COMBINE()
D. CONCATENATE()
E. GROUP()
A. 5
B. 6
C. 11
D. 30
E. 25
A. FROM
B. WHERE
C. HAVING
D. GROUP BY
E. SELECT
A. Customers in cities containing any combination of the letters "b" and "s" and "p."
B. Customers in cities starting with "bsp."
C. Customers in cities ending with "b" or "s" or "p."
D. Customers in cities starting with "b" or "s" or "p."
E. Customers in cities NOT starting with "b" or "s" or "p."
A. The value of a primary key constraint uniquely identifies each record in a table.
B. Primary keys must contain unique values.
C. A primary key column cannot contain NULL values.
D. For every primary key there must be a foreign key.
A. SELECT * FROM Person WHERE num_friends MORE THAN 1 AND name = 'John'
B. SELECT "John" as 'name' FROM `Person` WHERE `num_friends` > 1
C. SELECT name FROM Person WHERE num_friends > 1 AND name = 'John'
D. SELECT CONCAT(firstname, lastname) FROM Person WHERE num_friends > 1 AND name = "John"
A. SELECT FirstName FROM Persons;
B. SELECT * FROM Persons where FirstName = Persons;
C. SELECT * FROM Persons where Persons = FirstName;
D. SELECT First_Name FROM Persons;
A. SIGNAL statement
B. SELECT statement
C. WHILE statement
D. GOTO statement
E. SUBQUERY statement
A. Cross Join
B. Full Outer Join
C. Right Outer Join
D. Left Outer Join
E. Inner Join
A. Modifies the structure of an existing object in various ways.
B. Moves data from one table down to the next.
C. Deletes all data from a table in a very fast way, deleting the data inside the table and not the table itself.
D. Eliminates errors from the current table.
E. Deletes a database, table, index or column.
A. dot (.)
B. dash (-)
C. plus (+)
D. underscore (_)
A. unique identifier
B. primary key
C. secondary key
D. foreign key
A. index
B. query
C. program
D. table
A. To be used for filtering based on the outcome of non-aggregate functions.
B. To verify that at database connection is available.
C. To validate a constraint.
D. To be used for filtering based on the outcome of aggregate functions.
A. False
B. True
A. GROUP
B. SORT
C. SORT BY
D. GROUP BY
A. CONTAINS
B. BETWEEN
C. RANGE
D. WITHIN`
A. All tables will be deleted.
B. The entire database will be deleted.
C. All records will be deleted.
D. An error message will appear.
A. #
B. %
C. @
D. *
E. &
A. Instead of Trigger: Instead of Triggers are fired in place of the triggering action such as an insert, update, or delete.
B. All of these
C. After Trigger: After triggers execute following the triggering action, such as an insert, update, or delete.
A. FROM
B. SELECT
C. GROUP BY
D. WHERE
A. NEW_TABLE
B. ALIAS
C. NICKNAME
D. AS
A. join(col1, col2)
B. concat(col1, col2)
C. sql_concat(col1, col2)
D. col1 + col2
E. concatenate(col1, col2)
A. SQL Server
B. MySQL
C. SQLite
D. MongoDB
E. Oracle