NEW
Font size
Worksheetssql commands
Total questions: 35
Worksheet time: 26mins
Which statement allows us to add a record to a table?
Add To
Update To
Add Into
Insert Into
In existing table, ALTER TABLE statement is used to
Add columns
Add constraints
Delete columns
Delete constrains
All the above
This symbol is an SQL wildcard that can substitute for one or more characters when searching for data in a database.
$
%
=
*
If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default
ASC
DESC
There is no default value
None of the mentioned
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
With SQL, how do you select all the records from a table named “Persons” where the value of 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%’
Here which of the following displays the unique values of the column?
SELECT ________ dept_name
FROM instructor;
from
like
unique
distinct
Which of the following conditions has to be satisfied for INNER JOIN to work?
Columns used for joining must have different names
Columns used for joining must have same name
Columns used for joining can be of different types
Columns used for joining can have same or different name
Which of the following SQL statements will retrieve only the records where there is a match between the Customers and Orders tables?
SELECT * FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID;
SELECT * FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID;
SELECT * FROM Customers RIGHT JOIN Orders ON Customers.CustomerID = Orders.CustomerID;
Which keyword is used to filter the grouped rows in the result set based on a condition?
WHERE
GROUP BY
DISTINCT
HAVING
How can the name of Student "VIRAT" changed to "ROHIT"
UPDATE STUDENT SET NAME = 'ROHIT' HAVING NAME = 'VIRAT'
UPDATE NAME = 'VIRAT' WHERE NAME = 'VIRAT'
UPDATE TABLE STUDENT SET NAME = 'ROHIT' WHERE NAME = 'VIRAT'
UPDATE STUDENT SET NAME = 'ROHIT' WHERE NAME = 'VIRAT'
Select the correct foreign key constraint?
Referential Integrity
Entity Integrity
Domain Integrity
Foreign Integrity
During transaction before commit which of the following statements is done automatically in case of shutdown?
Rollback
Commit
View
Flashback
What is expected when you run the below statement .
TRUNCATE TABLE STUDENTS;
Will delete data from Students table but not commit the changes.
Will Delete all data from Students table successfully.
will throw exception
delete students table along with data
3. Which of the following is a TCL command
GRANT
UPDATE
ROLLBACK
ALTER
5. ___________ constraint ensures that no two rows have the same value in the specified columns.
Primary Key
Unique
Default
Check
8. ___________ ensure database integrity .
arguments
Constraints
clauses
variable
What is the full form of DDL ?
A.Dynamic Data Language
B.Detailed Data Language
C.Data Definition Language
D.Data Derivation Language
Which SQL function removes extra spaces before and after a string?
CONCAT()
LENGTH()
TRIM()
SUBSTRING()
What is the correct order of clauses in a SQL statement?
SELECT, FROM, ORDER BY, WHERE
SELECT, FROM, WHERE, ORDER BY
SELECT, WHERE, FROM, ORDER BY
WHERE, FROM, SELECT, ORDER BY
Which of these statements will show all wrestlers sorted from the heaviest to the lightest?
SELECT * FROM Wrestler WHERE weight <170;
SELECT * FROM Wrestler WHERE weight >170;
SELECT * FROM Wrestler ORDER BY weight ASC;
SELECT * FROM Wrestler ORDER BY weight DESC;
A table T_COUNT has 12 number values as 1, 2, 3, 32, 1, 1, null, 24, 12, null, 32, null. Predict the output of the below query.
SELECT COUNT (num) FROM t_count;
12
6
9
Throws exception because COUNT function doesn't works with NULL values
A table T_COUNT has 12 number values as 1, 2, 3, 32, 1, 1, null, 24, 12, null, 32, null. Predict the output of the below query.
SELECT COUNT (DISTINCT num) FROM t_count;
12
6
9
Throws exception because COUNT function doesn't works with NULL values
What does the following code snippet do?
SELECT TOP 5 * FROM students;
Select the top 5 entries for all the columns in the students' table.
Select all the entries from the students' table other than the top 5 entries
Selects all entries from the student table except 5 random rows
None of the above
INSERT INTO EMP VALUES(101,'SUMAN','MANAGER');
Which type of SQL statement is this?
Data Definition Language (DDL)
Data Manipulation Language (DML)
Value statement
Python statement
Which of the following is not a numeric function?
MOD
SIGN
MID
POW
What is the full form of TCL?
Transfer control language
Transportation control language
Transaction control language
Transaction collection language
What is the purpose of the TRUNCATE command in SQL?
To delete all records from a table
To remove a table from the database
To reset the auto-increment value
To create a new table
What does the term 'data integrity' refer to in databases?
The accuracy and consistency of data
The speed of data retrieval
The amount of data stored
The format of data presentation
What is the purpose of the CHECK constraint in SQL?
To provide a default value for a column
To create an index for faster retrieval
To ensure all values in a column are unique
To limit the type of data that can be stored in a column
What does the NOT NULL constraint ensure?
A column can only contain unique values
A column can have duplicate values
A column cannot have NULL values
A column must have a default value
What SQL clause is used to sort the result set?
SELECT
GROUP BY
WHERE
ORDER BY
What is the purpose of normalization in databases?
To increase data redundancy
To improve data retrieval speed
To reduce data redundancy
To enhance data security
Which of the following is a type of database that uses tables to define relationships?
Cloud database
NoSQL database
Relational database
Distributed database
