Skip to content

Create Riju.sql #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Riju.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
-- Create database
CREATE DATABASE IF NOT EXISTS mydatabase;

-- Use database
USE mydatabase;

-- Create table
CREATE TABLE customers (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
phone VARCHAR(20),
address TEXT
);

-- Insert data
INSERT INTO customers (name, email, phone, address)
VALUES
('John Doe', '[email protected]', '123-456-7890', '123 Main St'),
('Jane Doe', '[email protected]', '987-654-3210', '456 Elm St'),
('Bob Smith', '[email protected]', '555-123-4567', '789 Oak St');

-- Create another table
CREATE TABLE orders (
id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT,
order_date DATE,
total DECIMAL(10, 2),
FOREIGN KEY (customer_id) REFERENCES customers(id)
);

-- Insert data
INSERT INTO orders (customer_id, order_date, total)
VALUES
(1, '2022-01-01', 100.00),
(1, '2022-01-15', 200.00),
(2, '2022-02-01', 50.00);

-- Query data
SELECT * FROM customers;
SELECT * FROM orders;