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; (B)</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. (A)</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. (A)</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. (A)</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 (D)</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. (A)</p> Signup and view all the answers

Which of the following is a valid SQL type?

<p>All of the above (D)</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 (C)</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 (A)</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 (B)</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’; (B)</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. (C)</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. (B)</p> Signup and view all the answers

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

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

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

<p>DELETE (D)</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’; (D)</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 (B)</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 (C)</p> Signup and view all the answers

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

<p>SQL (C)</p> Signup and view all the answers

Which of the following is NOT a valid SQL type?

<p>CHARS (A)</p> Signup and view all the answers

How does SQL update records in a database?

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

Flashcards are hidden until you start studying

More Like This

SQL Database Query Basics
9 questions
SQL Query Design Basics
48 questions

SQL Query Design Basics

InvincibleChalcedony3952 avatar
InvincibleChalcedony3952
Use Quizgecko on...
Browser
Browser