SQL Set 1
Computer Science Engineering (CSE),
Bachelor of Science in Computer Science FY (BSc CS),
Bachelor of Science in Computer Science SY (BSc CS),
Bachelor of Science in Information Technology SY (BSc IT),
Bachelor of Computer Applications (BCA),
Bachelor of Business Administration in Computer Applications (BBA [CA]),
Bachelor of Science in Information Technology (BSc IT),
On This Page
This set of DataBase Management System (DBMS) Multiple Choice Questions & Answers (MCQs) focuses on SQL Set 1
Q1 | What does DML stand for?
- Different Mode Level
- Data Model Language
- Data Mode Lane
- Data Manipulation language
Q2 | With SQL, how do you select all the records from a table named “Persons” where the valueof the column “FirstName” ends with an “a”?
- SELECT * FROM Persons WHERE FirstName=’a’
- SELECT * FROM Persons WHERE FirstName LIKE ‘a%’
- SELECT * FROM Persons WHERE FirstName LIKE ‘%a’
- SELECT * FROM Persons WHERE FirstName=’%a%’
Q3 | With SQL, how can you return all the records from a table named “Persons” sorteddescending by “FirstName”?
- SELECT * FROM Persons SORT BY ‘FirstName’ DESC
- SELECT * FROM Persons ORDER FirstName DESC
- SELECT * FROM Persons SORT ‘FirstName’ DESC
- SELECT * FROM Persons ORDER BY FirstName DESC
Q4 | With SQL, how can you return the number of not null records in the “Persons” table?
- SELECT COUNT() FROM Persons
- SELECT COLUMNS() FROM Persons
- SELECT COLUMNS(*) FROM Persons
- SELECT COUNT(*) FROM Persons
Q5 | What does the ALTER TABLE clause do?
- The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints
- The SQL ALTER TABLE clause is used to insert data into database table
- THE SQL ALTER TABLE deletes data from database table
- The SQL ALTER TABLE clause is used to delete a database table
Q6 | The UPDATE SQL clause can _____________
- update only one row at a time
- update more than one row at a time
- delete more than one row at a time
- delete only one row at a time
Q7 | The UNION SQL clause can be used with _____________
- SELECT clause only
- DELETE and UPDATE clauses
- UPDATE clause only
- All of the mentioned
Q8 | Which SQL statement is used to return only different values?
- SELECT DIFFERENT
- SELECT UNIQUE
- SELECT DISTINCT
- SELECT ALL
Q9 | Which SQL keyword is used to sort the result-set?
- ORDER BY
- SORT
- ORDER
- SORT BY
Q10 | How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?
- UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
- MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
- MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
- UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
Q11 | Which of the following command makes the updates performed by the transactionpermanent in the database?
- ROLLBACK
- COMMIT
- TRUNCATE
- DELETE
Q12 | Which TCL command undo all the updates performed by the SQL in the transaction?
- ROLLBACK
- COMMIT
- TRUNCATE
- DELETE
Q13 | SQL query to find all the cities whose humidity is 95.
- SELECT city WHERE humidity = 95
- SELECT city FROM weather WHERE humidity = 95
- SELECT humidity = 89 FROM weather
- SELECT city FROM weather
Q14 | SQL query to find the temperature in increasing order of all cities.
- SELECT city FROM weather ORDER BY temperature
- SELECT city, temperature FROM weather
- SELECT city, temperature FROM weather ORDER BY temperature
- SELECT city, temperature FROM weather ORDER BY city
Q15 | What is the meaning of LIKE ‘%0%0%’?
- Feature begins with two 0’s
- Feature ends with two 0’s
- Feature has more than two 0’s
- Feature has two 0’s in it, at any position
Q16 | Find the names of these cities with temperature and condition whose condition is neithersunny nor cloudy.
- SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)
- SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)
- SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)
- SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);
Q17 | Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.
- SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70
- SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70
- SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70
- SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70
Q18 | Find all the tuples having a temperature greater than ‘Paris’.
- SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = ‘Paris’
- SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = ‘Paris’)
- SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city = ‘Paris’)
- SELECT * FROM weather WHERE temperature > ‘Paris’ temperature
Q19 | Find all the cities with temperature, condition and humidity whose humidity is in the rangeof 63 to 79.
- SELECT * FROM weather WHERE humidity IN (63 to 79)
- SELECT * FROM weather WHERE humidity NOT IN (63 AND 79)
- SELECT * FROM weather WHERE humidity BETWEEN 63 AND 79
- SELECT * FROM weather WHERE humidity NOT BETWEEN 63 AND 79
Q20 | The command to remove rows from a table ‘CUSTOMER’ is __________________
- DROP FROM CUSTOMER
- UPDATE FROM CUSTOMER
- REMOVE FROM CUSTOMER
- DELETE FROM CUSTOMER WHERE
Q21 | What type of join is needed when you wish to include rows that do not have matchingvalues?
- Equi-join
- Natural join
- Outer join
- All of the Mentioned
Q22 | What type of join is needed when you wish to return rows that do have matching values?
- Equi-join
- Natural join
- Outer join
- All of the Mentioned
Q23 | Which of the following is one of the basic approaches for joining tables?
- Subqueries
- Union Join
- Natural join
- All of the Mentioned
Q24 | The following SQL is which type of join: SELECT CUSTOMER_T. CUSTOMER_ID,ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,ORDER_T WHERE CUSTOMER_T. CUSTOMER_ID = ORDER_T. CUSTOMER_ID?
- Equi-join
- Natural join
- Outer join
- Cartesian join
Q25 | A UNION query is which of the following?
- Combines the output from no more than two queries and must include the same number of columns
- Combines the output from no more than two queries and does not include the same number of columns
- Combines the output from multiple queries and must include the same number of columns
- Combines the output from multiple queries and does not include the same number of columns