SQL Test 1

    Question 1: SQL Definition and Purpose

    What is SQL, and why is it used?

    Question 2: VARCHAR vs CHAR Data Types

    What is the difference between VARCHAR and CHAR data types?

    Question 3: CREATE TABLE vs CREATE DATABASE

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

    Question 4: GROUP BY Purpose and Function

    What is the purpose of GROUP BY clause in SQL?

    Question 5: SELECT * vs SELECT Column Names

    What is the difference between SELECT * and SELECT column_name?

    Question 6: Creating a Basic Index

    You want to improve the performance of queries that search for customers by their last name in a customers table. Which SQL statement correctly creates an index on the last_name column?

    Question 7: NOT Operator Usage

    How does the NOT operator work in SQL?

    Question 8: INNER JOIN Basic Concept

    What does INNER JOIN do in SQL?

    Question 9: OUTER JOIN Types Overview

    What are the types of OUTER JOINs in SQL?

    Question 10: Purpose of Aggregate Functions

    What is the main purpose of aggregate functions in SQL?

    Question 11: Database vs Table Distinction

    What is the difference between a database and a table?

    Question 12: INT vs BIGINT Comparison

    What is the difference between INT and BIGINT data types?

    Question 13: ALTER TABLE Capabilities

    What can the ALTER TABLE command do?

    Question 14: HAVING vs WHERE Clause Usage

    What is the difference between HAVING and WHERE clauses?

    Question 15: WHERE Clause Operators

    Which operators can be used in WHERE clause?

    Question 16: Index Purpose and Benefits

    What is the primary purpose of an index in SQL?

    Question 17: IN and BETWEEN Operators

    From a products table (product_id, product_name, category, price, supplier_id), select products in categories 'Electronics', 'Appliances', or 'Gadgets' with prices between $100 and $500, supplied by suppliers 101, 102, or 103.

    Question 18: Basic INNER JOIN Syntax

    You have two tables: customers (customer_id, name) and orders (order_id, customer_id, order_date). You want to list all orders along with the name of the customer who placed each order.

    Question 19: Basic LEFT OUTER JOIN

    You have two tables: customers (customer_id, name) and orders (order_id, customer_id, amount). You want to list all customers, including those who have not placed any orders, along with their order amounts (which will be NULL for customers with no orders).

    Question 20: COUNT Function Variations

    From an employees table (emp_id, name, department, salary, phone), write a query to show total number of employees, number of employees with phone numbers, and number of unique departments.