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
-- 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
-- ============================================= | |
-- MySQL Subqueries Demonstration | |
-- Online Store Database Example | |
-- ============================================= | |
-- Create database and set it as the active database | |
CREATE DATABASE online_store; | |
USE online_store; | |
-- ============================================= |
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
-- Create the database | |
CREATE DATABASE store_inventory; | |
-- Switch to the new database | |
USE store_inventory; | |
-- Create products table | |
CREATE TABLE products ( | |
product_id INT PRIMARY KEY, | |
product_name VARCHAR(50) NOT NULL, |