Introduction to SQL DDL, DML, DCL, and TCL Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Listen to an AI-generated conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What does DDL stand for in SQL?

  • Data Definition Language (correct)
  • Database Definition Language
  • Data Description Language
  • Data Design Language

Which SQL command is used to permanently remove a table and its data?

  • Drop (correct)
  • Delete
  • Truncate
  • Remove

What does DML stand for in SQL?

  • Data Modification Language
  • Database Management Language
  • Data Manipulation Language (correct)
  • Database Manipulation Language

Which SQL command is used to make a temporary backup of the current state of a transaction?

<p>Save Point (D)</p>
Signup and view all the answers

In SQL, which constraint is used to ensure that a column does not contain any duplicate values?

<p>Unique (D)</p>
Signup and view all the answers

What does DCL stand for in SQL?

<p>Data Control Language (B)</p>
Signup and view all the answers

What is the result of the SQL query: Select Emp_Name From Employees Where Emp_ID = 2 ?

<p>Amal (D)</p>
Signup and view all the answers

In the SQL query: Select * From Employees Where Not Nationality = 'Egyptian', what does the 'Not' operator do?

<p>Retrieves records where the nationality is not Egyptian (C)</p>
Signup and view all the answers

What does the SQL query: Select Emp_ID , Emp_Name , Salary From Employees Where Emp_ID IN (1 , 3 , 5) retrieve?

<p>Employee ID, Name, and Salary for employees with IDs 1, 3, and 5 (B)</p>
Signup and view all the answers

What is retrieved by the SQL query: Select * From Employees Where Emp_Name IN ('Ali' , 'Omar' , 'Amal')?

<p>Records for employees named Ali, Omar, or Amal (A)</p>
Signup and view all the answers

What does the SQL query: Select * From Employees Where Emp_Name Like 'A%' retrieve?

<p>Records for employees whose name starts with 'A' (D)</p>
Signup and view all the answers

What is retrieved by the SQL query: Select * From Employees Where Emp_Name Like 'Z%B'?

<p>Records for employees whose name starts with 'Z' followed by a single character and then 'B' (C)</p>
Signup and view all the answers

What is retrieved by the SQL query: Select * From Employees Where Emp_Name Like 'Al_'?

<p>Records for employees whose name contains 'Al' followed by a single character (B)</p>
Signup and view all the answers

In the SQL query: Select Emp_Name , FUN , Address From Employees Where Phone Is Null, what does 'Phone Is Null' represent?

<p>'Phone' field has no data (D)</p>
Signup and view all the answers

What is the result of the SQL query: Select Emp_ID , Emp_Name , Salary From Employees Where Salary Between 4000 And 6000 ?

<p>(5, Ali, 4000), (8, Aly, 4500), (2, Amal, 5000), (3, Mona, 6000) (A)</p>
Signup and view all the answers

What is the result of the SQL query: Select Max (Salary) as Max , Min (Salary) as Min , Avg (Salary) as Average From Employees ?

<p>(Max: 7000, Min: 3000, Average: 4500) (B)</p>
Signup and view all the answers

Flashcards are hidden until you start studying

Study Notes

SQL Acronyms and Concepts

  • DDL stands for Data Definition Language, used for defining database structures.
  • DML stands for Data Manipulation Language, used for manipulating data.
  • DCL stands for Data Control Language, used for controlling access and permissions.

SQL Commands and Constraints

  • The SQL command DROP TABLE is used to permanently remove a table and its data.
  • The SAVEPOINT command is used to make a temporary backup of the current state of a transaction.
  • The UNIQUE constraint is used to ensure that a column does not contain any duplicate values.

SQL Queries and Operators

  • The NOT operator is used to negate a condition in a query.
  • The IN operator is used to select rows that match any value in a list.
  • The LIKE operator is used to select rows that match a pattern.
  • The IS NULL condition is used to select rows where a column is null.

SQL Query Results

  • A query with a WHERE clause and a specific value (e.g. Emp_ID = 2) will return a single row that matches the condition.
  • A query with an IN operator will return rows that match any value in the list.
  • A query with a LIKE operator will return rows that match the pattern (e.g. Emp_Name Like 'A%' will return rows where the employee name starts with 'A').
  • A query with a range condition (e.g. Salary Between 4000 And 6000) will return rows that fall within the specified range.
  • Aggregate functions (e.g. MAX, MIN, AVG) can be used to calculate aggregate values for a column.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Use Quizgecko on...
Browser
Browser