This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- SQL DELETE Tutorial | |
| -- Demonstrates how to remove records from a database table | |
| -- DELETE FROM table_name WHERE condition; | |
| -- Create a database for our examples | |
| CREATE DATABASE delete_tutorial; | |
| -- Use the database | |
| USE delete_tutorial; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- REPLACE INTO SQL Demonstration | |
| -- This script demonstrates how REPLACE INTO combines INSERT and DELETE operations | |
| -- to simplify the process of updating or inserting records based on primary or unique key values. | |
| -- Create and use database | |
| CREATE DATABASE replace_demo; | |
| USE replace_demo; | |
| -- Create products table | |
| CREATE TABLE products ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Self JOIN in SQL Demonstration | |
| -- This script demonstrates how to use Self JOINs to query hierarchical and relational data | |
| -- within the same table, using an employee management system example. | |
| -- Create and use database | |
| CREATE DATABASE self_join_tutorial; | |
| USE self_join_tutorial; | |
| -- Create employees table with manager_id referencing the same table | |
| CREATE TABLE employees ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- StoreDB Complete SQL Script | |
| -- This script creates a sample database with products and orders tables | |
| -- and demonstrates various SQL query examples | |
| -- Create the database | |
| CREATE DATABASE StoreDB; | |
| USE StoreDB; | |
| -- Create products table | |
| CREATE TABLE products ( |
OlderNewer