Chap_8 & 9: SQL Quiz
24 Questions
13 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which SQL statement is used to retrieve data from a database?

  • UPDATE
  • INSERT
  • DELETE
  • SELECT (correct)
  • Which SQL clause is used to filter data based on specified conditions?

  • GROUP BY
  • ORDER BY
  • WHERE (correct)
  • HAVING
  • Which of the following is the CORRECT order of keywords for SQL SELECT statements?

  • SELECT, FROM, WHERE (correct)
  • FROM, WHERE, SELECT
  • WHERE, FROM, SELECT
  • SELECT, WHERE, FROM
  • The command to eliminate the table from a database is _____.

    <p>DROP TABLE Customer;</p> Signup and view all the answers

    What is the difference between the DELETE and DROP commands?

    <p>DELETE command will delete row(s) of a table, while the DROP command delete the structure and content (data) of the table.</p> Signup and view all the answers

    DELETE FROM Customer WHERE State =’Negeri Sembilan’; .

    What does the following SQL statement do?

    <p>Deletes all records from the customer table where the state is equal to Negeri Sembilan.</p> Signup and view all the answers

    What is the difference between the CREATE DATABASE and CREATE TABLE commands?

    <p>CREATE DATABASE is used to create a new database, while CREATE TABLE is used to create a new table within the existing database.</p> Signup and view all the answers

    SQL can be used to:

    i. Create database structures ii. Query database data iii. Modify database data

    <p>i, ii and iii</p> Signup and view all the answers

    What happens when you omit the WHERE clause in a DELETE statement?

    <p>All rows in the table are removed.</p> Signup and view all the answers

    Which of the following is a valid SQL type?

    <p>All of the above</p> Signup and view all the answers

    What is the output of the following SQL statement?

    SELECT * FROM employees;

    <p>Retrieves all rows and columns from the “employees” table</p> Signup and view all the answers

    Which are Data Manipulation Language (DML) statements?

    i. SELECT ii. ALTER iii. DROP iv. DELETE

    <p>i and iv</p> Signup and view all the answers

    What will the following SQL do?

    DROP DATABASE mydb;

    <p>Delete a database named mydb from the system</p> Signup and view all the answers

    In UPDATE statement, choose the correct answer to update firstname= Mary to firstname = Marry from a table named “staff”.

    <p>UPDATE staff SET FName = ‘Marry’ WHERE LName =’Mary’;</p> Signup and view all the answers

    Which of the following statement is TRUE about SQL?

    <p>SQL is used for managing and manipulating relational databases.</p> Signup and view all the answers

    How do DML commands differ from DDL commands in SQL?

    <p>DML commands operate on existing tables, while DDL commands define how data is stored.</p> Signup and view all the answers

    Which SQL statement is used to insert data into a table?

    <p>INSERT INTO</p> Signup and view all the answers

    Which SQL statement is used to remove rows of data from the database table?

    <p>DELETE</p> Signup and view all the answers

    In UPDATE statement, choose the correct answer to update firstname= Jamy to firstname = Jammy from a table named “staff”.

    <p>UPDATE staff SET FName = ‘Jammy’ WHERE LName =’Jamy’;</p> Signup and view all the answers

    Which are Data Definition Language (DDL) statements?

    i. SELECT ii. ALTER iii. DROP iv. DELETE

    <p>ii and iii</p> Signup and view all the answers

    1. What is the output of the following SQL statement?

    SELECT * FROM student;

    <p>Retrieves all rows and columns from the “student” table</p> Signup and view all the answers

    Which language is commonly used to query and manipulate data in a relational database?

    <p>SQL</p> Signup and view all the answers

    Which of the following is NOT a valid SQL type?

    <p>CHARS</p> Signup and view all the answers

    How does SQL update records in a database?

    <p>By modifying existing data values</p> Signup and view all the answers

    More Like This

    Use Quizgecko on...
    Browser
    Browser