Question : What is a table in SQL?
A table is a collection of related data organized in rows and columns.
Solution :
Correct Answer : Collection of rows and columns
Description -
Question : Which SQL command is used to create a table?
Solution :
Correct Answer : CREATE TABLE
Description -
Question : Which command removes all records but keeps the table structure?
Solution :
Correct Answer : TRUNCATE
Description -
Question : Which command removes both data and table structure?
Solution :
Correct Answer : DROP TABLE
Description -
Question : Which command is used to rename a table?
Solution :
Correct Answer : RENAME TABLE
Description -
Question : Which command deletes selected rows from a table?
Solution :
Correct Answer : DELETE
Description -
Question : Which statement deletes all rows using DELETE?
DELETE FROM Student;
Solution :
Correct Answer : Deletes all rows
Description -
Question : Which command is faster for removing all records?
Solution :
Correct Answer : TRUNCATE
Description -
Question : Which SQL command copies data from one table to another?
Solution :
Correct Answer : INSERT INTO SELECT
Description -
Question : Which table exists temporarily during a session?
Solution :
Correct Answer : Temp Table
Description -
Question : Which keyword creates a temporary table?
Solution :
Correct Answer : Both TEMP & TEMPORARY
Description -
Question : Which command modifies table structure?
Solution :
Correct Answer : ALTER TABLE
Description -
Question : Which command adds a new column?
ALTER TABLE Student ADD age INT;
Solution :
Correct Answer : Adds column
Description -
Question : Which command removes a column?
Solution :
Correct Answer : DROP COLUMN
Description -
Question : Which command changes column datatype?
Solution :
Correct Answer : ALTER TABLE MODIFY
Description -
Question : Which statement is used to rename a column in MySQL?
Solution :
Correct Answer : CHANGE COLUMN
Description -
Question : Which operation cannot be rolled back in many DBMS?
Solution :
Correct Answer : TRUNCATE
Description -
Question : Which command removes duplicate structure and data permanently?
Solution :
Correct Answer : DROP TABLE
Description -
Question : What will this command do? CREATE TABLE Emp AS
SELECT * FROM Employee;
Solution :
Correct Answer : Copy structure and data
Description -
Question : Which SQL command changes table name from Student to Learner?
Solution :
Correct Answer : RENAME TABLE Student TO Learner;
Description -
Question : Which command preserves auto increment reset?
Solution :
Correct Answer : TRUNCATE
Description -
Question : Which command is DDL?
Solution :
Correct Answer : CREATE TABLE
Description -
Question : Which command belongs to DML?
Solution :
Correct Answer : DELETE
Description -
Question : What is the default storage object in SQL?
Solution :
Correct Answer : Table
Description -
Question : Which statement creates a temp table?
CREATE TEMP TABLE Test(
id INT
);
Solution :
Correct Answer : Temporary table
Description -
Question : Which command copies only structure without data?
Solution : CREATE TABLE NewTable AS
Correct Answer :
SELECT * FROM OldTable WHERE 1=0;
Description -
Question : Which command can add constraints to existing table?
Solution :
Correct Answer : ALTER TABLE
Description -
Question : Which is TRUE about DELETE?
Solution :
Correct Answer : Deletes selected rows
Description -
Question : Which command is used before removing a table permanently?
Solution :
Correct Answer : DROP TABLE
Description -