0% found this document useful (0 votes)
132 views

SQL Practice Databases

The document details the creation of a SQL practice database including tables for regions, countries, locations, departments, jobs, employees and dependents. Data is inserted into each table with sample records to populate the database for practicing SQL queries. Primary and foreign keys are defined to link the tables together in a relational database structure.

Uploaded by

M.I.M KRUPHA
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

SQL Practice Databases

The document details the creation of a SQL practice database including tables for regions, countries, locations, departments, jobs, employees and dependents. Data is inserted into each table with sample records to populate the database for practicing SQL queries. Primary and foreign keys are defined to link the tables together in a relational database structure.

Uploaded by

M.I.M KRUPHA
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

SQL PRACTICE DATABASE

CREATION OF DATABASE:

CREATE TABLE regions (

region_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

region_name text NOT NULL

);

CREATE TABLE countries (

country_id text NOT NULL,

country_name text NOT NULL,

region_id INTEGER NOT NULL,

PRIMARY KEY (country_id ASC),


FOREIGN KEY (region_id) REFERENCES regions (region_id) ON DELETE CASCADE ON UPDATE
CASCADE

);

CREATE TABLE locations (

location_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

street_address text,

postal_code text,

city text NOT NULL,

state_province text,

country_id INTEGER NOT NULL,

FOREIGN KEY (country_id) REFERENCES countries (country_id) ON DELETE CASCADE ON


UPDATE CASCADE

);

CREATE TABLE departments (

department_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

department_name text NOT NULL,

location_id INTEGER NOT NULL,

FOREIGN KEY (location_id) REFERENCES locations (location_id) ON DELETE CASCADE ON


UPDATE CASCADE

);

CREATE TABLE jobs (

job_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

job_title text NOT NULL,

min_salary double NOT NULL,

max_salary double NOT NULL

);

CREATE TABLE employees (

employee_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,


first_name text,

last_name text NOT NULL,

email text NOT NULL,

phone_number text,

hire_date text NOT NULL,

job_id INTEGER NOT NULL,

salary double NOT NULL,

manager_id INTEGER,

department_id INTEGER NOT NULL,

FOREIGN KEY (job_id) REFERENCES jobs (job_id) ON DELETE CASCADE ON UPDATE CASCADE,

FOREIGN KEY (department_id) REFERENCES departments (department_id) ON DELETE


CASCADE ON UPDATE CASCADE,

FOREIGN KEY (manager_id) REFERENCES employees (employee_id) ON DELETE CASCADE ON


UPDATE CASCADE

);

CREATE TABLE dependents (

dependent_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

first_name text NOT NULL,

last_name text NOT NULL,

relationship text NOT NULL,

employee_id INTEGER NOT NULL,

FOREIGN KEY (employee_id) REFERENCES employees (employee_id) ON DELETE CASCADE


ON UPDATE CASCADE

);

INSERTION OF VALUES ON DATABASE:

/*Data for the table regions */

INSERT INTO regions(region_id,region_name) VALUES (1,'Europe');

INSERT INTO regions(region_id,region_name) VALUES (2,'Americas');

INSERT INTO regions(region_id,region_name) VALUES (3,'Asia');


INSERT INTO regions(region_id,region_name) VALUES (4,'Middle East and Africa');

/*Data for the table countries */

INSERT INTO countries(country_id,country_name,region_id) VALUES ('AR','Argentina',2);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('AU','Australia',3);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('BE','Belgium',1);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('BR','Brazil',2);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('CA','Canada',2);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('CH','Switzerland',1);

INSERT INTO countries(country_id,

country_name,region_id) VALUES ('CN','China',3);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('DE','Germany',1);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('DK','Denmark',1);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('EG','Egypt',4);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('FR','France',1);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('HK','HongKong',3);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('IL','Israel',4);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('IN','India',3);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('IT','Italy',1);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('JP','Japan',3);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('KW','Kuwait',4);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('MX','Mexico',2);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('NG','Nigeria',4);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('NL','Netherlands',1);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('SG','Singapore',3);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('UK','United Kingdom',1);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('US','United States of


America',2);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('ZM','Zambia',4);

INSERT INTO countries(country_id,country_name,region_id) VALUES ('ZW','Zimbabwe',4);


/*Data for the table locations */

INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id)


VALUES (1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US');

INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id)


VALUES (1500,'2011 Interiors Blvd','99236','South San Francisco','California','US');

INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id)


VALUES (1700,'2004 Charade Rd','98199','Seattle','Washington','US');

INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id)


VALUES (1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA');

INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id)


VALUES (2400,'8204 Arthur St',NULL,'London',NULL,'UK');

INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id)


VALUES (2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK');

INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id)


VALUES (2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE');

/*Data for the table jobs */

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (1,'Public


Accountant',4200.00,9000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (2,'Accounting


Manager',8200.00,16000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (3,'Administration


Assistant',3000.00,6000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES


(4,'President',20000.00,40000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (5,'Administration Vice


President',15000.00,30000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (6,'Accountant',4200.00,9000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (7,'Finance


Manager',8200.00,16000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (8,'Human Resources


Representative',4000.00,9000.00);
INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES
(9,'Programmer',4000.00,10000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (10,'Marketing


Manager',9000.00,15000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (11,'Marketing


Representative',4000.00,9000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (12,'Public Relations


Representative',4500.00,10500.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (13,'Purchasing


Clerk',2500.00,5500.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (14,'Purchasing


Manager',8000.00,15000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (15,'Sales


Manager',10000.00,20000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (16,'Sales


Representative',6000.00,12000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (17,'Shipping


Clerk',2500.00,5500.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (18,'Stock


Clerk',2000.00,5000.00);

INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (19,'Stock


Manager',5500.00,8500.00);

/*Data for the table departments */

INSERT INTO departments(department_id,department_name,location_id) VALUES


(1,'Administration',1700);

INSERT INTO departments(department_id,department_name,location_id) VALUES


(2,'Marketing',1800);

INSERT INTO departments(department_id,department_name,location_id) VALUES


(3,'Purchasing',1700);

INSERT INTO departments(department_id,department_name,location_id) VALUES (4,'Human


Resources',2400);

INSERT INTO departments(department_id,department_name,location_id) VALUES


(5,'Shipping',1500);

INSERT INTO departments(department_id,department_name,location_id) VALUES (6,'IT',1400);


INSERT INTO departments(department_id,department_name,location_id) VALUES (7,'Public
Relations',2700);

INSERT INTO departments(department_id,department_name,location_id) VALUES (8,'Sales',2500);

INSERT INTO departments(department_id,department_name,location_id) VALUES


(9,'Executive',1700);

INSERT INTO departments(department_id,department_name,location_id) VALUES


(10,'Finance',1700);

INSERT INTO departments(department_id,department_name,location_id) VALUES


(11,'Accounting',1700);

/*Data for the table employees */

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(100,'Steven','King','[email protected]','515.123.4567','1987-06-17',4,24000.00,NULL,9);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(101,'Neena','Kochhar','[email protected]','515.123.4568','1989-09-
21',5,17000.00,100,9);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (102,'Lex','De Haan','lex.de
[email protected]','515.123.4569','1993-01-13',5,17000.00,100,9);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(103,'Alexander','Hunold','[email protected]','590.423.4567','1990-01-
03',9,9000.00,102,6);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(104,'Bruce','Ernst','[email protected]','590.423.4568','1991-05-21',9,6000.00,103,6);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(105,'David','Austin','[email protected]','590.423.4569','1997-06-25',9,4800.00,103,6);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(106,'Valli','Pataballa','[email protected]','590.423.4560','1998-02-05',9,4800.00,103,6);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(107,'Diana','Lorentz','[email protected]','590.423.5567','1999-02-07',9,4200.00,103,6);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(108,'Nancy','Greenberg','[email protected]','515.124.4569','1994-08-
17',7,12000.00,101,10);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(109,'Daniel','Faviet','[email protected]','515.124.4169','1994-08-16',6,9000.00,108,10);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (110,'John','Chen','[email protected]','515.124.4269','1997-
09-28',6,8200.00,108,10);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(111,'Ismael','Sciarra','[email protected]','515.124.4369','1997-09-
30',6,7700.00,108,10);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (112,'Jose Manuel','Urman','jose
[email protected]','515.124.4469','1998-03-07',6,7800.00,108,10);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (113,'Luis','Popp','[email protected]','515.124.4567','1999-12-
07',6,6900.00,108,10);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(114,'Den','Raphaely','[email protected]','515.127.4561','1994-12-
07',14,11000.00,100,3);
INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(115,'Alexander','Khoo','[email protected]','515.127.4562','1995-05-
18',13,3100.00,114,3);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (116,'Shelli','Baida','[email protected]','515.127.4563','1997-
12-24',13,2900.00,114,3);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(117,'Sigal','Tobias','[email protected]','515.127.4564','1997-07-24',13,2800.00,114,3);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(118,'Guy','Himuro','[email protected]','515.127.4565','1998-11-15',13,2600.00,114,3);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(119,'Karen','Colmenares','[email protected]','515.127.4566','1999-08-
10',13,2500.00,114,3);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(120,'Matthew','Weiss','[email protected]','650.123.1234','1996-07-
18',19,8000.00,100,5);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (121,'Adam','Fripp','[email protected]','650.123.2234','1997-
04-10',19,8200.00,100,5);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(122,'Payam','Kaufling','[email protected]','650.123.3234','1995-05-
01',19,7900.00,100,5);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(123,'Shanta','Vollman','[email protected]','650.123.4234','1997-10-
10',19,6500.00,100,5);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(126,'Irene','Mikkilineni','[email protected]','650.124.1224','1998-09-
28',18,2700.00,120,5);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (145,'John','Russell','[email protected]',NULL,'1996-10-
01',15,14000.00,100,8);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (146,'Karen','Partners','[email protected]',NULL,'1997-
01-05',15,13500.00,100,8);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (176,'Jonathon','Taylor','[email protected]',NULL,'1998-
03-24',16,8600.00,100,8);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (177,'Jack','Livingston','[email protected]',NULL,'1998-04-
23',16,8400.00,100,8);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (178,'Kimberely','Grant','[email protected]',NULL,'1999-
05-24',16,7000.00,100,8);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (179,'Charles','Johnson','[email protected]',NULL,'2000-
01-04',16,6200.00,100,8);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (192,'Sarah','Bell','[email protected]','650.501.1876','1996-
02-04',17,4000.00,123,5);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(193,'Britney','Everett','[email protected]','650.501.2876','1997-03-
03',17,3900.00,123,5);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(200,'Jennifer','Whalen','[email protected]','515.123.4444','1987-09-
17',3,4400.00,101,1);
INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(201,'Michael','Hartstein','[email protected]','515.123.5555','1996-02-
17',10,13000.00,100,2);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES (202,'Pat','Fay','[email protected]','603.123.6666','1997-08-
17',11,6000.00,201,2);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(203,'Susan','Mavris','[email protected]','515.123.7777','1994-06-07',8,6500.00,101,4);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(204,'Hermann','Baer','[email protected]','515.123.8888','1994-06-
07',12,10000.00,101,7);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(205,'Shelley','Higgins','[email protected]','515.123.8080','1994-06-
07',2,12000.00,101,11);

INSERT INTO
employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manag
er_id,department_id) VALUES
(206,'William','Gietz','[email protected]','515.123.8181','1994-06-07',1,8300.00,205,11);

/*Data for the table dependents */

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(1,'Penelope','Gietz','Child',206);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(2,'Nick','Higgins','Child',205);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(3,'Ed','Whalen','Child',200);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(4,'Jennifer','King','Child',100);
INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES
(5,'Johnny','Kochhar','Child',101);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(6,'Bette','De Haan','Child',102);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(7,'Grace','Faviet','Child',109);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(8,'Matthew','Chen','Child',110);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(9,'Joe','Sciarra','Child',111);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(10,'Christian','Urman','Child',112);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(11,'Zero','Popp','Child',113);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(12,'Karl','Greenberg','Child',108);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(13,'Uma','Mavris','Child',203);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(14,'Vivien','Hunold','Child',103);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(15,'Cuba','Ernst','Child',104);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(16,'Fred','Austin','Child',105);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(17,'Helen','Pataballa','Child',106);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(18,'Dan','Lorentz','Child',107);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(19,'Bob','Hartstein','Child',201);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(20,'Lucille','Fay','Child',202);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(21,'Kirsten','Baer','Child',204);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(22,'Elvis','Khoo','Child',115);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(23,'Sandra','Baida','Child',116);
INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES
(24,'Cameron','Tobias','Child',117);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(25,'Kevin','Himuro','Child',118);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(26,'Rip','Colmenares','Child',119);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(27,'Julia','Raphaely','Child',114);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(28,'Woody','Russell','Child',145);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(29,'Alec','Partners','Child',146);

INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES


(30,'Sandra','Taylor','Child',176);

SELECT QUERY FOR DATABASES:

--select query for regions

SELECT * from regions;

--select query for countries

SELECT * from countries;

--select query for departments

select * from departments;

--select query for dependents

select* from dependents;

--select query for employees

SELECT * from employees;

--select query for location

select * from locations;

--select query for jobs

select * from jobs;

SELECT DISNTINCT QUERY FOR DATABASES:

--select query for regions


SELECT DISTINCT region_name from regions;

--select query for countries

SELECT DISTINCT country_id from countries;

--select query for departments

select DISTINCT location_id from departments;

--select query for dependents

select DISTINCT employee_id from dependents;

--select query for employees

SELECT DISTINCT department_id from employees;

--select query for location

select distinct country_id from locations;

--select query for jobs

select DISTINCT job_title from jobs;

SELECT QUERY WITH WHERE CONDITION

--select query where the region is asia

SELECT * from regions where region_name="Asia";

--select query where the region id is 2(Americas)

SELECT * from countries where region_id=2;

--select query where location code is 1700(US washington)

select * from departments WHERE location_id=1700;

--select query where realtionship is child

select * from dependents where relationship="Child";

--select query where department id if 6

SELECT * from employees where department_id=6;

--select query where country id is US

select * from locations where country_id="US";

--select query where min salaray is 4000

select * from jobs where min_salary=4000;

You might also like