0% found this document useful (0 votes)
4 views6 pages

practice data

The document contains SQL commands to create and manage various database tables including Employees, Employee, Triangle, Logs, Products, Queue, Accounts, Movies, Users, MovieRating, Customer, RequestAccepted, and Insurance. Each table is created with specific fields and data types, and existing tables are truncated before inserting new data entries. The document outlines the structure and initial data for these tables, which cover a range of entities such as employees, products, movies, and customer transactions.

Uploaded by

george bonny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

practice data

The document contains SQL commands to create and manage various database tables including Employees, Employee, Triangle, Logs, Products, Queue, Accounts, Movies, Users, MovieRating, Customer, RequestAccepted, and Insurance. Each table is created with specific fields and data types, and existing tables are truncated before inserting new data entries. The document outlines the structure and initial data for these tables, which cover a range of entities such as employees, products, movies, and customer transactions.

Uploaded by

george bonny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Create table If Not Exists Employs(employee_id int, name varchar(20), reports_to int, age int)

Truncate table Employees

insert into Employees (employee_id, name, reports_to, age) values ('9', 'Hercy', 'None', '43')

insert into Employees (employee_id, name, reports_to, age) values ('6', 'Alice', '9', '41')

insert into Employees (employee_id, name, reports_to, age) values ('4', 'Bob', '9', '36')

insert into Employees (employee_id, name, reports_to, age) values ('2', 'Winston', 'None', '37')

Create table If Not Exists Employee (employee_id int, department_id int, primary_flag ENUM('Y','N'))

Truncate table Employee

insert into Employee (employee_id, department_id, primary_flag) values ('1', '1', 'N')

insert into Employee (employee_id, department_id, primary_flag) values ('2', '1', 'Y')

insert into Employee (employee_id, department_id, primary_flag) values ('2', '2', 'N')

insert into Employee (employee_id, department_id, primary_flag) values ('3', '3', 'N')

insert into Employee (employee_id, department_id, primary_flag) values ('4', '2', 'N')

insert into Employee (employee_id, department_id, primary_flag) values ('4', '3', 'Y')

insert into Employee (employee_id, department_id, primary_flag) values ('4', '4', 'N')

Create table If Not Exists Triangle (x int, y int, z int)

Truncate table Triangle

insert into Triangle (x, y, z) values ('13', '15', '30')

insert into Triangle (x, y, z) values ('10', '20', '15')


Create table If Not Exists Logs (id int, num int)

Truncate table Logs

insert into Logs (id, num) values ('1', '1')

insert into Logs (id, num) values ('2', '1')

insert into Logs (id, num) values ('3', '1')

insert into Logs (id, num) values ('4', '2')

insert into Logs (id, num) values ('5', '1')

insert into Logs (id, num) values ('6', '2')

insert into Logs (id, num) values ('7', '2')

Create table If Not Exists Products (product_id int, new_price int, change_date date)

Truncate table Products

insert into Products (product_id, new_price, change_date) values ('1', '20', '2019-08-14')

insert into Products (product_id, new_price, change_date) values ('2', '50', '2019-08-14')

insert into Products (product_id, new_price, change_date) values ('1', '30', '2019-08-15')

insert into Products (product_id, new_price, change_date) values ('1', '35', '2019-08-16')

insert into Products (product_id, new_price, change_date) values ('2', '65', '2019-08-17')

insert into Products (product_id, new_price, change_date) values ('3', '20', '2019-08-18')

Create table If Not Exists Queue (person_id int, person_name varchar(30), weight int, turn int)

Truncate table Queue

insert into Queue (person_id, person_name, weight, turn) values ('5', 'Alice', '250', '1')

insert into Queue (person_id, person_name, weight, turn) values ('4', 'Bob', '175', '5')
insert into Queue (person_id, person_name, weight, turn) values ('3', 'Alex', '350', '2')

insert into Queue (person_id, person_name, weight, turn) values ('6', 'John Cena', '400', '3')

insert into Queue (person_id, person_name, weight, turn) values ('1', 'Winston', '500', '6')

insert into Queue (person_id, person_name, weight, turn) values ('2', 'Marie', '200', '4')

Create table If Not Exists Accounts (account_id int, income int)

Truncate table Accounts

insert into Accounts (account_id, income) values ('3', '108939')

insert into Accounts (account_id, income) values ('2', '12747')

insert into Accounts (account_id, income) values ('8', '87709')

insert into Accounts (account_id, income) values ('6', '91796')

Create table If Not Exists Employees (employee_id int, name varchar(20), manager_id int, salary int)

Truncate table Employees

insert into Employees (employee_id, name, manager_id, salary) values ('3', 'Mila', '9', '60301')

insert into Employees (employee_id, name, manager_id, salary) values ('12', 'Antonella', 'None', '31000')

insert into Employees (employee_id, name, manager_id, salary) values ('13', 'Emery', 'None', '67084')

insert into Employees (employee_id, name, manager_id, salary) values ('1', 'Kalel', '11', '21241')

insert into Employees (employee_id, name, manager_id, salary) values ('9', 'Mikaela', 'None', '50937')

insert into Employees (employee_id, name, manager_id, salary) values ('11', 'Joziah', '6', '28485')

Create table If Not Exists Employ (employee_id int, name varchar(20), manager_id int, salary int)

Truncate table Employees


insert into Employees (employee_id, name, manager_id, salary) values ('3', 'Mila', '9', '60301')

insert into Employees (employee_id, name, manager_id, salary) values ('12', 'Antonella', 'None', '31000')

insert into Employees (employee_id, name, manager_id, salary) values ('13', 'Emery', 'None', '67084')

insert into Employees (employee_id, name, manager_id, salary) values ('1', 'Kalel', '11', '21241')

insert into Employees (employee_id, name, manager_id, salary) values ('9', 'Mikaela', 'None', '50937')

insert into Employees (employee_id, name, manager_id, salary) values ('11', 'Joziah', '6', '28485')

Create table If Not Exists Seat (id int, student varchar(255))

Truncate table Seat

insert into Seat (id, student) values ('1', 'Abbot')

insert into Seat (id, student) values ('2', 'Doris')

insert into Seat (id, student) values ('3', 'Emerson')

insert into Seat (id, student) values ('4', 'Green')

insert into Seat (id, student) values ('5', 'Jeames')

Create table If Not Exists Movies (movie_id int, title varchar(30))

Create table If Not Exists Users (user_id int, name varchar(30))

Create table If Not Exists MovieRating (movie_id int, user_id int, rating int, created_at date)

Truncate table Movies

insert into Movies (movie_id, title) values ('1', 'Avengers')

insert into Movies (movie_id, title) values ('2', 'Frozen 2')

insert into Movies (movie_id, title) values ('3', 'Joker')

Truncate table Users

insert into Users (user_id, name) values ('1', 'Daniel')

insert into Users (user_id, name) values ('2', 'Monica')

insert into Users (user_id, name) values ('3', 'Maria')


insert into Users (user_id, name) values ('4', 'James')

Truncate table MovieRating

insert into MovieRating (movie_id, user_id, rating, created_at) values ('1', '1', '3', '2020-01-12')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('1', '2', '4', '2020-02-11')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('1', '3', '2', '2020-02-12')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('1', '4', '1', '2020-01-01')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('2', '1', '5', '2020-02-17')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('2', '2', '2', '2020-02-01')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('2', '3', '2', '2020-03-01')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('3', '1', '3', '2020-02-22')

insert into MovieRating (movie_id, user_id, rating, created_at) values ('3', '2', '4', '2020-02-25')

Create table If Not Exists Customer (customer_id int, name varchar(20), visited_on date, amount int)

Truncate table Customer

insert into Customer (customer_id, name, visited_on, amount) values ('1', 'Jhon', '2019-01-01', '100')

insert into Customer (customer_id, name, visited_on, amount) values ('2', 'Daniel', '2019-01-02', '110')

insert into Customer (customer_id, name, visited_on, amount) values ('3', 'Jade', '2019-01-03', '120')

insert into Customer (customer_id, name, visited_on, amount) values ('4', 'Khaled', '2019-01-04', '130')

insert into Customer (customer_id, name, visited_on, amount) values ('5', 'Winston', '2019-01-05', '110')

insert into Customer (customer_id, name, visited_on, amount) values ('6', 'Elvis', '2019-01-06', '140')

insert into Customer (customer_id, name, visited_on, amount) values ('7', 'Anna', '2019-01-07', '150')

insert into Customer (customer_id, name, visited_on, amount) values ('8', 'Maria', '2019-01-08', '80')

insert into Customer (customer_id, name, visited_on, amount) values ('9', 'Jaze', '2019-01-09', '110')

insert into Customer (customer_id, name, visited_on, amount) values ('1', 'Jhon', '2019-01-10', '130')

insert into Customer (customer_id, name, visited_on, amount) values ('3', 'Jade', '2019-01-10', '150')
Create table If Not Exists RequestAccepted (requester_id int not null, accepter_id int null, accept_date
date null)

Truncate table RequestAccepted

insert into RequestAccepted (requester_id, accepter_id, accept_date) values ('1', '2', '2016/06/03')

insert into RequestAccepted (requester_id, accepter_id, accept_date) values ('1', '3', '2016/06/08')

insert into RequestAccepted (requester_id, accepter_id, accept_date) values ('2', '3', '2016/06/08')

insert into RequestAccepted (requester_id, accepter_id, accept_date) values ('3', '4', '2016/06/09')

Create Table If Not Exists Insurance (pid int, tiv_2015 float, tiv_2016 float, lat float, lon float)

Truncate table Insurance

insert into Insurance (pid, tiv_2015, tiv_2016, lat, lon) values ('1', '10', '5', '10', '10')

insert into Insurance (pid, tiv_2015, tiv_2016, lat, lon) values ('2', '20', '20', '20', '20')

insert into Insurance (pid, tiv_2015, tiv_2016, lat, lon) values ('3', '10', '30', '20', '20')

insert into Insurance (pid, tiv_2015, tiv_2016, lat, lon) values ('4', '10', '40', '40', '40')

You might also like