Introduction to SQL DDL, DML, DCL, and TCL Quiz
16 Questions
6 Views

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

Created by
@RiskFreeSamarium

Podcast Beta

Play an AI-generated podcast conversation about this lesson

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</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</p> Signup and view all the answers

    What does DCL stand for in SQL?

    <p>Data Control Language</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</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</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</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</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'</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'</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</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</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)</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)</p> Signup and view all the answers

    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

    Description

    Test your knowledge of SQL Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), and Transaction Control Language (TCL) with this quiz. Topics such as Create, Drop, Truncate, Rename, Alter, Comments, Insert, Delete, Update, Select, Grant, Revoke, Commit, Rollback, and more are covered.

    More Like This

    Use Quizgecko on...
    Browser
    Browser