Font size
WorksheetsXII Database & SQL
Total questions: 61
Worksheet time: 31mins
Which SQL function is used to count the number of rows in a SQL query?
COUNT()
NUMBER()
SUM()
COUNT(*)
Which of the following SQL clauses is used to DELETE tuples from a database table?
DELETE
REMOVE
DROP
CLEAR
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
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%’
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
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
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’
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
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
The command to remove rows from a table ‘CUSTOMER’ is __________________
DROP FROM CUSTOMER
UPDATE FROM CUSTOMER
REMOVE FROM CUSTOMER
DELETE FROM CUSTOMER WHERE
The number of rows in a relation
degree
tuple
cardinality
domain
SQL stands for
(a)
Repetition of data is called data ..............
dependance
redundancy
inconsistency
isolation
Mismatched redundant copies of data is known as data ............
dependance
redundancy
inconsistency
isolation
A ............ is an organized collection of structured data.
information
file
database
DBMS
A data ................ is a set of rules that define valid data.
constraint
data dictionary
query
all of these
A relational database consists of a collection of ..............
tables
fields
records
keys
Data redundancy may lead to data inconsistency.
True
False
In relational data model, the total number of rows can be identified as ______________________ .
Cardinality
Degree
Attribute
Entity
Identify the total number of attributes in a relational data model.
Tuple
Entity
Degree
Cardinality
Columns are called as Fields.
True
False
To store fix sized text char data type is used.
True
False
Each row of data in a table is called a tuple.
True
False
A Foreign key is used to represent the relationship between two relations.
True
False
Tables are organized in the form of ___________ and______________.
Report
Rows
Query
Columns
Count() -> return the no. of records in a table .
True
False
______ command is used to see the structure of a table.
Drop
Insert
Select
Describe
Which command eliminate the duplicate record in a table?
Drop
Insert
Distinct
Update
Q4 Which command is used for filtering the record in a table?
Distinct
Order by
Describe
Where
Which command is used to add/modify/remove a column from a table?
Insert
Update
Alter
Delete
In RDBMS, table is known as ________
Tuple
Relation
Attribute
Domain
View is a virtual table?
True
False
In RDBMS, field is known as ________
Tuple
Relation
Attribute
Domain
The Primary Key identifies the record uniquely in a table?
True
False
What SQL clause is used to restrict the rows returned by a query ?
WHEN
HAVING
FROM
WHERE
Which of the following can add a row to a table ?
Add
Insert
Update
Alter
Which SQL statement is used to insert new data in database ?
INSERT INTO
UPDATE
ADD
INSERT NEW
Which one will delete the table data as well as table structure?
DELETE
DROP
What is a foreign key ?
A foreign key is a key field in table , which relates the table to another table where the key is a primary key or unique key.
Constraint (reference integrity)
The foreign key is a column that can have NULL value
The foreign key is a column that can not have NULL values
GRANT & REVOKE IS THE
DDL
DML
DCL
TCL
CREATE & DROP IS A ----------STATEMENT
DDL
DCL
DML
TCL
SELECT & INSERT
DDL
DML
DCL
TCL
Which of the following is an application of DBMS?
Banking
Airlines
university
All of them
Database is a collection of
Data
Related data
Correct data
fields
Pool of values from where a column draws the value is called .............
table
attribute
dataset
domain
The column which has unique values in all the rows but is not a primary key is called ............. key.
candidate
alternate
composite
foreign
This symbol is placed immediately after the SELECT command to display all the fields.
$
%
=
*
What is the meaning of DDL?
Data Definition Language
Database definition Language
Data Definition Link
Data Division Langauge
The _____ command is used to modify columns in a table
DROP
INSERT
ALTER
CREATE
delete * from employee;
Deletes all tuples.
updates the table emp with null.
Destroys the table.
select all the record
select all DML commands are:-
INSERT
UPDATE
DELETE
GRANT
select all DDL commands are:-
UPDATE
ALTER
DROP
DELETE
Which of the following is the correct order of keywords for SQL SELECT statements?
SELECT, FROM, WHERE
FROM, WHERE, SELECT
WHERE, FROM,SELECT
SELECT,WHERE,FROM
A ___________ is a specific type of field in a relational database that can identify each unique record independently
Candidate Key
Primary key
Surrogate key
Unique Key
The COUNT() function also counts the NULL values.
True
False
The average value of the given numeric column is calculated by using - - - function.
GETAVG()
FINDAVG()
AVG()
AVGVALUE()
