WorksheetsMYSQL Leval-1
Total questions: 30
Worksheet time: 16mins
What are the types of JOINs in SQL?
SELECT answer
FROM options
WHERE question = 'Types of JOINs in SQL';
RIGHT JOIN
LEFT JOIN
OUTER JOIN
INNER JOIN
What does DML stand for?
SELECT answer
FROM options
WHERE question = 'DML meaning';
Data Management Language
Data Manipulation Language
Data Modeling Language
Data Monitoring Language
Which of the following are DML commands?
SELECT answer
FROM options
WHERE question = 'DML commands';
SELECT
INSERT
DELETE
COMMIT
What are the DCL commands?
SELECT answer
FROM options
WHERE question = 'DCL commands';
GRANT
REVOKE
REMANE
DENY
Which of the following are DDL commands?
SELECT answer
FROM options
WHERE question = 'DDL commands';
CREATE
DROP
COMMIT
ALTER
What are the TCL commands?
SELECT answer
FROM options
WHERE question = 'TCL commands';
COMMIT
ROLLBACK
INSERT
GRANT
CREATE DATABASE college;
Creates a new table named college
Deletes the college database
Creates a new database named college
Adds a column named college
USE college;
Question : What does this command mean?
Runs all tables inside college
Switches to the college database
Drops the college database
Grants access to all users in college
What is the purpose of this syntax?
Inserts a new student
Creates a table named students with two columns
Updates a student record
Selects all students
What does this command do?
Updates Karthik's name
Creates the students table
Inserts one record into students table
Selects one student
What does this query do?
Deletes all students
Shows only student names
Retrieves all columns and rows from students table
Creates a student record
What does this syntax do?
Creates a new database called books
Creates a table named books with two columns
Adds data to the books table
Drops the books table
What does this query do?
Deletes the book with id 1
Changes the title of book with id 1
Creates a new table
Adds a new book
What is the purpose of this command?
Deletes the entire table
Deletes the book with id = 1
Updates a book title
Selects all books
What will this command return?
Books with any title
Books where title starts with S
Deletes books starting with S
Creates a new book entry
What does the above SQL command do?
Deletes a database
Creates a new table
Creates a new database named LibraryDB
Adds a new column
What is the data type CHAR used for?
VARCHAR (Flexible string)
TEXT (Large text)
CHAR (Fixed-length string)
LONGTEXT (Very large text)
What kind of values will this column store?
Integer values
Floating point values
Exact decimal values
Boolean values
What does the DATETIME type store?
Only the date
Only the time
Both date and time
Boolean
What does this SQL statement do?
Deletes all books
Shows all columns and rows from the table
Inserts a new book
Updates book prices
Which query will show all employees whose name starts with 'A'?
SELECT * FROM employee WHERE ename = 'A%';
SELECT * FROM employee WHERE ename LIKE 'A%';
SELECT ename FROM employee WHERE ename = 'A';
SELECT * FROM employee WHERE ename LIKE '%A';
Which query counts how many employees are in 'SALES'?
SELECT COUNT(job_desc) FROM employee;
SELECT COUNT(*) FROM employee WHERE job_desc = 'SALES';
SELECT * FROM employee WHERE job_desc = 'SALES';
SELECT COUNT(ename) FROM employee GROUP BY job_desc;
Which one gives the average salary of all employees?
SELECT SUM(salary) FROM employee;
SELECT AVG(salary) FROM employee;
SELECT salary FROM employee ORDER BY salary;
SELECT MAX(salary) FROM employee;
Which query updates all ENGINEER roles to Analyst?
UPDATE employee SET job_desc = 'Analyst' WHERE job_desc = 'ENGINEER';
UPDATE employee SET job_desc = 'ENGINEER' WHERE job_desc = 'Analyst';
UPDATE employee job_desc = 'Analyst' FROM employee WHERE job_desc = 'ENGINEER';
ALTER employee SET job_desc = 'Analyst' WHERE job_desc = 'ENGINEER';
Which command shows the name in UPPERCASE?
SELECT UPPER(ename) FROM employee;
SELECT UCASE(ename) FROM employee;
SELECT ename FROM employee;
SELECT UCASE(ename) FROM employee WHERE LCASE = TRUE;
What is the purpose of AUTO_INCREMENT in the id column?
It automatically sets id as the highest number
It fills the id column with NULL
It auto-generates unique incremental values for id
It makes id a string
What will happen if this INSERT command is run?
It adds a new book with id = NULL
It adds a new row and auto-generates id
It throws an error due to missing id
It adds duplicate data
What does this query return?
All employees
Only the employee with the lowest salary
Employees whose salary is equal to the maximum salary
Employees whose salary is NULL
What does this query do?
It groups the data by job_desc
It orders the records randomly
It sorts employee records by job role in a specific priority
It filters only CEOs and Managers
What does this query return?
All job_desc with their average salary
Only job_desc where average salary is below 50000
Only job_desc where average salary is more than 50000
Employees whose salary is more than 50000
