SQL
All Questions for: SQL
Question 1: What is the full form of ?
- A Structured Query Language
- B Simple Query Language
- C Structured Query List
Explanation: No explanation available.
Question 2: Find all the tuples having temperature greater than ''Paris''.
- A SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = ''Paris'')
- B SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city = ''Paris'')
- C SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = ''Paris'')
Explanation: No explanation available.
Question 3: What is the meaning of LIKE ''%0%0%
- A Feature begins with two 0''s
- B Feature ends with two 0''s
- C Feature has more than two 0''s
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 4: Which SQL keyword is used to retrieve only unique values?
- A UNIQUE
- B DISTINCTIVE
- C DISTINCT
Explanation: No explanation available.
Question 5: What is an SQL virtual table that is constructed from other tables?
- A Just another table
- B view
- C A relation
Explanation: No explanation available.
Question 6: The SQL keyword BETWEEN is used:
- A to limit the columns displayed.
- B as a wildcard.
- C for ranges.
Explanation: No explanation available.
Question 7: The result of a SQL SELECT statement is a ________ .
- A report
- B file
- C table
Explanation: No explanation available.
Question 8: The SQL WHERE clause:
- A limits the row data are returned.
- B limits the column data that are returned.
- C Both A and B are correct.
Explanation: No explanation available.
Question 9: The FROM SQL clause is used to...
- A specify what table we are selecting or deleting data FROM
- B specify search condition
- C specify range for search condition
Explanation: No explanation available.
Question 10: Which of the following do you need to consider when you make a table in SQL?
- A Data types
- B Primary keys
- C Default values
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 11: Which of the following join is also called as an ''inner-join''?
- A Non-Equijoin
- B Self-Join
- C Equijoin
Explanation: No explanation available.
Question 12: Which of the following is illegal?
- A SELECT SYSDATE - SYSDATE FROM DUAL;
- B SELECT SYSDATE - (SYSDATE - 2) FROM DUAL;
- C SELECT SYSDATE - (SYSDATE + 2) FROM DUAL;
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 13: The command to remove rows from a table ''CUSTOMER'' is:
- A DROP FROM CUSTOMER ...
- B UPDATE FROM CUSTOMER ...
- C REMOVE FROM CUSTOMER ...
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 14: Which SQL statement is used to delete data FROM a database?
- A COLLAPSE
- B REMOVE
- C ALTER
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 15: Which of the following is the original purpose of SQL?
- A To specify the syntax and semantics of SQL data definition language
- B To define the data structures
- C To specify the syntax and semantics of SQL manipulation language
Explanation: No explanation available.
Question 16: NULL is
- A the same as 0 for integer
- B the same as blank for character
- C the same as 0 for integer and blank for character
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 17: A command that lets you change one or more fields in a record is
- A Look-up
- B Modify
- C Insert
Explanation: No explanation available.
Question 18: When using the SQL INSERT statement:
- A rows can be modified according to criteria only.
- B rows cannot be copied in mass from one table to another only.
- C rows can either be inserted into a table one at a time or in groups.
Explanation: No explanation available.
Question 19: What SQL command can be used to add columns to a table?
- A ALTER TABLE TableName ADD ColumnName
- B MODIFY TABLE TableName ADD ColumnName
- C ALTER TABLE TableName ADD COLUMN ColumnName
Explanation: No explanation available.
Question 20: Which of the following group functions ignore NULL values?
- A MAX
- B COUNT
- C SUM
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 21: SQL can be used to:
- A create database structures only.
- B query database data only.
- C modify database data only.
- D N/A / Missing in source dump
Explanation: No explanation available.
Question 22: Which command undo all the updates performed by the SQL in the transaction?
- A TRUNCATE
- B ROLLBACK
- C COMMIT
Explanation: No explanation available.
Question 23: Which SQL query returns the maximum salary from the employee table?
- A SELECT salary FROM employee WHERE salary = MAX(salary);
- B SELECT MAX(salary) FROM employee;
- C SELECT TOP salary FROM employee;
Explanation: The correct option is: Option B
Question 24: Which SQL operator is used to combine the result of two SELECT statements?
- A UNION
- B JOIN
- C INTERSECT
Explanation: The correct option is: Option A
Question 25: Which of the following is true about PRIMARY KEY in SQL?
- A It allows NULL values
- B There can be many primary keys in a table
- C It uniquely identifies each record in a table
Explanation: The correct option is: Option C
Question 26: Which SQL statement removes all rows from a table but keeps the table structure?
- A DELETE * FROM table_name;
- B TRUNCATE TABLE table_name;
- C DROP TABLE table_name;
Explanation: The correct option is: Option B
Question 27: What is the purpose of a FOREIGN KEY in SQL?
- A To link two tables together
- B To enforce uniqueness of a column
- C To speed up queries
Explanation: The correct option is: Option A
Question 28: What does the BETWEEN operator do in SQL?
- A Checks for exact equality
- B Checks if a value is greater than another
- C Checks if a value is within a range
Explanation: The correct option is: Option C
Question 29: Which SQL clause groups rows sharing a property into summary rows?
- A GROUP BY
- B ORDER BY
- C HAVING
Explanation: The correct option is: Option A
Question 30: Why is the HAVING clause used in SQL?
- A To filter rows before grouping
- B To filter groups after aggregation
- C To order the rows
Explanation: The correct option is: Option B
Question 31: What is the main purpose of an INDEX in SQL?
- A To speed up retrieval of rows
- B To enforce referential integrity
- C To remove duplicates
Explanation: The correct option is: Option A
Question 32: Which SQL query selects employees with no commission (commission is NULL)?
- A SELECT * FROM employee WHERE commission = 0;
- B SELECT * FROM employee WHERE commission = 'NULL';
- C SELECT * FROM employee WHERE commission IS NULL;
Explanation: The correct option is: Option C
Question 33: Which symbol is used in SQL as a wildcard to match zero or more characters?
- A %
- B _
- C *
Explanation: The correct option is: Option A
Question 34: Which SQL constraint ensures that a column cannot have NULL values?
- A UNIQUE
- B NOT NULL
- C PRIMARY KEY
Explanation: The correct option is: Option B
Question 35: Which operator is used in SQL to concatenate strings in Oracle?
- A +
- B ||
- C &
Explanation: The correct option is: Option C
Question 36: Which SQL query orders results by department_id ascending and salary descending?
- A SELECT * FROM employees ORDER BY department_id ASC, salary DESC;
- B SELECT * FROM employees ORDER BY department_id, salary;
- C SELECT * FROM employees SORT BY department_id, salary;
Explanation: The correct option is: Option A
Question 37: Which of the following best describes a VIEW in SQL?
- A A permanent copy of a table
- B A virtual table based on a query
- C A temporary backup of data
Explanation: The correct option is: Option B
Question 38: In SQL, which keyword is used in a SELECT to return only distinct rows?
- A UNIQUE
- B ONLY
- C DISTINCT
Explanation: The correct option is: Option C
Question 39: Which SQL function returns the current date and time?
- A NOW()
- B CURDATE()
- C TODAY()
Explanation: The correct option is: Option A
Question 40: Which SQL keyword is used to implement conditional logic in queries?
- A IF
- B CASE
- C SWITCH
Explanation: The correct option is: Option B
Question 41: Which SQL statement deletes rows from a table?
- A DELETE FROM table_name WHERE condition;
- B DROP table_name;
- C REMOVE FROM table_name;
Explanation: The correct option is: Option A
Question 42: Which SQL statement is used to modify existing rows in a table?
- A MODIFY table_name SET column=value;
- B UPDATE table_name SET column=value WHERE condition;
- C CHANGE table_name SET column=value;
Explanation: The correct option is: Option B
Question 43: Which SQL keyword is used to give a column a temporary name?
- A RENAME
- B ALIAS
- C AS
Explanation: The correct option is: Option C
Question 44: Which SQL operator is used to test whether a value matches any value in a list?
- A IN
- B ANY
- C MATCHES
Explanation: The correct option is: Option A
Question 45: Which SQL comparison is used to check if a value is NULL?
- A value = NULL
- B value IS NULL
- C value == NULL
Explanation: The correct option is: Option B
Question 46: Is the SQL BETWEEN operator inclusive of boundary values?
- A Yes, it includes both values
- B No, it excludes both values
- C Yes, but only the lower value
Explanation: The correct option is: Option A
Question 47: Which statement is true regarding DROP and DELETE?
- A DROP removes rows, DELETE removes table
- B Both commands remove only rows
- C DELETE removes rows, DROP removes the table
Explanation: The correct option is: Option C
Question 48: Which SQL command is used to change an existing table structure?
- A ALTER TABLE
- B CHANGE STRUCTURE
- C MODIFY TABLE
Explanation: The correct option is: Option A
Question 49: What does COUNT(*) return in SQL?
- A The count of non-null values only
- B The total number of rows including NULLs
- C The count of unique values
Explanation: The correct option is: Option B
Question 50: Which SQL query updates salary to 50000 and commission to 10 for employee_id = 101?
- A UPDATE employees SET salary=50000, commission=10 WHERE employee_id=101;
- B UPDATE employees SET (salary, commission)=(50000,10) WHERE employee_id=101;
- C MODIFY employees SET salary=50000 AND commission=10 WHERE employee_id=101;
Explanation: The correct option is: Option A