WorksheetsSQL Queries - DDL
Total questions: 15
Worksheet time: 9mins
What will be the output of this query?
SELECT * FROM employees;
Retrieve all rows in the employee database
Retrieve all rows from the employee table
Retrieve all columns from the employee database
Retrieve all columns from employee table
Question 2
How will a data analyst retrieve a list of all employees' first_name, last_name and hire_date from the employees table?
select first_name,last_name,hire_date, from employee;
select first_name,last_name and hire_date from employees;
Select first_name,last_name& hire_date from employees;
select first_name,last_name,hire_date from employees;
Which of these SQL statements will select all the members with last names that start with capital letter "M" in the table member?
select * from member where last_name="M%";
select * from member where last_name="M-"
Select * from member where last_name="M"
select * from member where last_name like "M%"
What will be the result of this query?
SELECT dept_name
FROM Departments
WHERE dept_no BETWEEN 'd003' AND 'd006';
Select all department name whose department number is not between d003 and d006;
select all department names whose department number is between d003 and d006;
select a list of all departments whose department number is between d003 and d006;
SELECT statement is a ...............in SQL
Data Control Language(DCL)
Transcation Control language(TCL)
Data Manipulation language(DML)
Data Definition language(DDL)
COUNT is a .................function
Aggregate
procedure
user-defined
Summarizing
Which of the following is a valid SQL statement to select all the members who live in T from the table member?
select * from member
select * from member where state_abbravation="T"
select * from member where state_abbrevation=='T'
select * from member where state_abbravation is T
Difference between ALTER Table command and UPDATE command :
ALTER is DDL command and is used for modifying the schema of table
UPDATE is DML command and is
used for modifying the existing data of table
Using Alter command any value inside the table can be modified.
Using Update command columns of a table can be renamed.
Match SQL language with SQL commands
1)DDL i)Revok, Grant
2)DML ii)rename a table
3)TCL iii)insert, update
4)DCL iv)rollback , commit
1-iii,2-i,3-ii,4-iv
1-iii,2-ii,3-iv,4-i
1-ii,2-iii,3-iv,4-i
1-i,2-iii,3-ii,4-iv
Which of the following attributes can be considered as a choice for a primary key?
Name
Street
RollNo
Subject
How would you display Chairs in the Items table that have a Price greater than £50.
SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50
SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100
SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50
SELECT * FROM Items WHERE Price > 50
Which would find pupils with "er" anywhere in their name?
SELECT * FROM Pupils Where Name = "%er"
SELECT * FROM Pupils Where Name = "$er$"
SELECT * FROM Pupils Where Name = "%er%"
SELECT * FROM Pupils Where Name = "er%"
Which of the following query contains error?
SELECT * FROM Emp WHERE Empid=1001;
SELECT Empid FROM Emp WHERE Empid=1001;
SELECT Empid FROM Emp;
SELECT Empid WHERE empid=1001;
Which statement is used to count number of rows in table?
SELECT COUNT(*) FROM table_name;
SELECT COUNT ALL(*) FROM table_name;
SELECT ROWS(*) FROM table_name;
All the above
