SQL Quiz Sections
During transaction before commit which of the following statements is done automatically in case of shutdown? a) Rollback b) Commit c) View d) Flashback
A
How can we view all the triggers currently in the database? a) SHOW b) VIEW c) READ d) None of the above
A
How many operations are considered to be most the basic SQL operations? a) 4 b) 3 c) 2 d) 1
A
SQL Stands for... a) Structured Query Language b) Sample Query Language c) Structured Query List d) None of the above
A
Select the correct foreign key constraint a) Referential integrity b) Entity integrity c) Domain integrity d) None of the above
A
To select some particular columns, which of the following commands is used? a) PROJECTION b) SELECTION c) JOIN d) UNION
A
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
A
What does BLOB in SQL stand for? a) Binary Large Objects b) Big Large Objects c) Binary Language for Objects d) None of the above
A
What does the following code snippet do? ALTER TABLE STUDENT(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
A
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
A
What does the following code snippet do? SELECT TOP 5 * FROM students; a) Select the top 5 entries for all the columns b) Select all the entries from the students' table other than the top 5 entries c) Select all entries from the student table except for 5 random rows d) None of the above
A
What does the following statement 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.
A
What is the AS clause used for? a) Rename b) Selection c) Join d) Projection
A
Which of the following SQL functions compares the similarities of 2 strings and returns the result as a 4 character code? a) SOUNDEX b) DIFFERENCE c) CONCAT d) None of the above
A
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
A
Which of the following commands is used to delete a trigger in SQL? a) DROP b) DELETE c) ALTER d) None of the above
A
Which of the following commands is used to delete all rows and free up space from a table? a) TRUNCATE b) DROP c) DELETE d) ALTER
A
Which of the following function do we use to get a specified day of the month for a given date? a) DAY b) DATEPART c) GETDATE d) CURRENT_TIMESTAMP
A
Which of the following is not a SQL command? a) DELETE b) ORDER BY c) SELECT d) WHERE
A
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
A
Primary key can be.. a) NULL b) NOT NULL c) Both NULL and NOT NULL d) Depends on the situation
B
SQL views are also known as... a) Schema b) Virtual Table c) Instance d) None of the above
B
The program which performs some common action on database data and is also stored there is called? a) Trigger b) Stored Procedure c) Stored Function d) None of the above
B
What is a table joined with itself called? a) Join b) Self-join c) Outer join d) None of the above
B
What is the name of the query that is placed within a WHERE or HAVING clause of another query? a) Multi query b) Subquery c) Super Query d) Master Query
B
When is the wildcard in WHERE clause used? a) An exact match is necessary for a CREATE statement b) An exact match is not possible in a SELECT statement c) An exact match is necessary for a SELECT statement d) None of the above
B
Which of the following can replace the below query? SELECT Name, ID FROM Student, Courses WHERE Student_ID = Courses_ID; a) Select Name, ID from Courses, Student where Student_ID = ID; b) Select Name, ID from Student natural join Courses c) Select Name, ID from Student; d) Select ID from Student join Courses;
B
Which of the following constraints can be defined only at the column level? a) UNIQUE b) NOT NULL c) CHECK d) PRIMARY KEY
B
Which of the following datatypes is most appropriate for storing a string up to 255 characters a) TEXT b) TINY TEXT c) BLOB d) BINARY
B
Which of the following operators is used to compare a value to a list of literal values that have been specified? a) ANY b) BETWEEN c) IN d) ALL
B
Group of operations that form a single logical unit of work is called? a) Network b) Unit c) Transaction d) None of the above
C
How can SQL injections occur? a) Data is used to dynamically construct an SQL query b) Unintended data from an untrusted source source enters the application c) Both A and B d) None of the above
C
NATURAL JOIN can be also be termed as a) Combination of Union and cartesian product b) Combination of Selection and cartesian product c) Combination of Projection and cartesian product d) None of the above
C
What are rows of a relation known as? a) Degree b) Entity c) Tuple d) None
C
What happens when no value is inserted in a ENUM list? a) Nothing happens b) The code will crash c) A blank value is inserted in that case d) None of the above
C
What is the range of integers that can be held in the MEDIUMINT datatype of SQL? a) Signed numbers in the range of -8388606 to 8388607 b) Unsigned numbers in the range of 0 to 16777215 c) Both Unsigned and Signed numbers d) Neither signed or unsigned numbers
C
What will be the output of the following code snippet? SELECT ROUND(TRUNCATE(MOD(2500,20),-1,2) FROM dual; a) Error b) 00 c) 0 d) 1
C
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
C
Which of the following allows you to uniquely identify a tuple? a) Schema b) Attribute c) Super key d) Domain
C
Which of the following are TCL commands? a) ROLLBACK b) SAVEPOINT c) ROLLBACK and SAVEPOINT d) None of the above
C
Which of the following are types of Unicode character string types in SQL? a) nchar b) ntext c) both A and B d) None of the above
C
Which of the following commands are part of the Data Control Language? a) Revoke b) Grant c) Both Revoke and Grant d) None of the above
C
Which of the following is known as the minimal super key? a) Primary key b) Foreign key c) Candidate key d) None of the above
C
Which of the following matches the definition given below: It is an artificial key that aims to uniquely identify each record. a) Primary Key b) Foreign Key c) Surrogate Key d) Composite Key
C
Which of the is not a DDL command? a) REVOKE b) GRANT c) UPDATE d) RENAME
C
How can the user change "Scaler" into "Interviewbit" in the "Name" column in the Users table? a) UPDATE User SET Name = 'Scaler' INTO Name = 'Interviewbit' b) MODIFY Users SET Name = 'Interviewbit' WHERE Name = 'Scaler' c) MODIFY Users SET Name = 'Scaler' INTO Name = 'Interviewbit' d) UPDATE Users SET Name = 'Interviewbit' WHERE Name = 'Scaler'
D
Identify the concurrency-based protocol? a) Lock based protocol b) Two-phase locking protocol c) Timestamp ordering protocol d) All of the above
D
Select the valid SQL type a) NUMERIC b) CHARACTER c) FLOAT d) All of the above
D
What is NOLOCK in SQL equivalent to? a) WRITE UNCOMMITTED b) READ COMMITTED c) WRITE UNCOMMITTED d) READ UNCOMMITTED
D
Which of the following are some common RDBMS in use? a) Oracle b) MySql c) HeidiSQL d) All of the above
D
Which of the following are valid SQL constraints? a) NOT NULL b) CHECK c) UNIQUE d) All of the above
D
Which of the following are valid logical operators in SQL? a) SOME b) ALL c) AND d) All of the above
D
Which of the following is also known as a concatenated key? a) Primary Key b) Foreign Key c) Surrogate Key d) Composite Key
D
Which of the following is not a valid SQL type? a) NUMERIC b) DECIMAL c) CHARACTER d) None of the above
D
Which of the following is not a valid aggregate function? a) count() b) Sum() c) Avg() d) None of the above
D