Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ All Rights Reserved.
Licensed under the LinkedIn Learning Exercise File License (the "License").
See LICENSE in the project root for license information.

ATTRIBUTIONS:
[PLEASE PROVIDE ATTRIBUTIONS OR DELETE THIS AND THE ABOVE LINE “ATTRIBUTIONS”]

Please note, this project may automatically load third party code from external
repositories (for example, NPM modules, Composer packages, or other dependencies).
If so, such third party code may be subject to other license terms than as set
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# COURSENAME
This is the repository for the LinkedIn Learning course `course-name`. The full course is available from [LinkedIn Learning][lil-course-url].
# Hands-On Introduction: SQL
This is the repository for the LinkedIn Learning course Hands-On Introduction: SQL. The full course is available from [LinkedIn Learning][lil-course-url].

![Hands-On Introduction: SQL ][lil-thumbnail-url]

Join instructor Deepa Maddala as she uses hands-on lessons to teach you the tools, techniques, and know-how that you need to start using SQL from day one. Deepa guides you through using the Select statement to fetch and filter data, creating and adding to tables and data, modifying existing tables, and what to use in different scenarios. She includes simple examples with each topic she covers.<br><br>The best way to learn a language is to use it in practice. That’s why this course is integrated with GitHub Codespaces, an instant cloud developer environment that offers all the functionality of your favorite IDE without the need for any local machine setup. With GitHub Codespaces, you can get hands-on practice from any machine, at any time—all while using a tool that you’ll likely encounter in the workplace. Check out the [Using GitHub Codespaces with this course][gcs-video-url] video to learn how to get started.

![course-name-alt-text][lil-thumbnail-url]

_See the readme file in the main branch for updated instructions and information._
## Instructions
This repository has branches for each of the videos in the course. You can use the branch pop up menu in github to switch to a specific branch and take a look at the course at that stage, or you can add `/tree/BRANCH_NAME` to the URL to go to the branch you want to access.

Expand All @@ -22,15 +24,13 @@ To resolve this issue:
Add changes to git using this command: git add .
Commit changes using this command: git commit -m "some message"

## Installing
1. To use these exercise files, you must have the following installed:
- [list of requirements for course]
2. Clone this repository into your local machine using the terminal (Mac), CMD (Windows), or a GUI tool like SourceTree.
3. [Course-specific instructions]

### Instructor

[0]: # (Replace these placeholder URLs with actual course URLs)
Deepa Maddala

[lil-course-url]: https://www.linkedin.com/learning/
[lil-thumbnail-url]: http://
Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/deepa-maddala?u=104).

[lil-course-url]: https://www.linkedin.com/learning/hands-on-introduction-sql
[lil-thumbnail-url]: https://media.licdn.com/dms/image/D560DAQFce8T-RjMmAg/learning-public-crop_675_1200/0/1667324559752?e=1667955600&v=beta&t=fSwTEREJ2cKzBWmkRcZcirnwL306jvMsnhG0fjLRayA
[gcs-video-url]: https://www.linkedin.com/learning/hands-on-introduction-sql/using-github-codespaces-with-this-course
Binary file added database.db
Binary file not shown.
File renamed without changes.
7 changes: 7 additions & 0 deletions queries/00_01/create_dept_copy_tab.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE dept_copy_tab
(
deptno NUMBER,
dname VARCHAR2(50),
mgr_id NUMBER(10),
location_id NUMBER(10)
);
8 changes: 8 additions & 0 deletions queries/00_01/create_dept_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE dept_tab
(
deptno NUMBER(5),
dname VARCHAR2(50),
mgr_id NUMBER(10),
location_id NUMBER(10),
CONSTRAINT pk_dept_tab PRIMARY KEY (deptno)
);
14 changes: 14 additions & 0 deletions queries/00_01/create_emp_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TABLE emp_tab
(
empno NUMBER,
name VARCHAR2(50) NOT NULL,
job VARCHAR2(50),
manager NUMBER(10),
hiredate DATE,
salary NUMBER(10,2),
commission NUMBER(10,2),
deptno NUMBER(5),
CONSTRAINT pk_emp_tab PRIMARY KEY (empno),
CONSTRAINT fk_emp_tab_deptno FOREIGN KEY (deptno)
REFERENCES dept_tab(deptno)
);
11 changes: 11 additions & 0 deletions queries/00_01/create_old_emp_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE old_emp_tab
(
empno NUMBER,
name VARCHAR2(50) not null,
job VARCHAR2(50),
manager NUMBER(10),
hiredate DATE,
salary NUMBER(10,2),
commission NUMBER(10,2),
deptno NUMBER(5)
);
162 changes: 162 additions & 0 deletions queries/00_01/insert_dept_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
INSERT INTO dept_tab VALUES
( 30
, 'Purchasing'
, 114
, 1700
);

INSERT INTO dept_tab VALUES
( 40
, 'Human Resources'
, 203
, 2400
);



INSERT INTO dept_tab VALUES
( 70
, 'Public Relations'
, 204
, 2700
);

INSERT INTO dept_tab VALUES
( 80
, 'Sales'
, 145
, 2500
);

INSERT INTO dept_tab VALUES
( 90
, 'Executive'
, 100
, 1700
);

INSERT INTO dept_tab VALUES
( 100
, 'Finance'
, 108
, 1700
);

INSERT INTO dept_tab VALUES
( 110
, 'Accounting'
, 205
, 1700
);

INSERT INTO dept_tab VALUES
( 120
, 'Treasury'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 130
, 'Corporate Tax'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 140
, 'Control And Credit'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 150
, 'Shareholder Services'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 160
, 'Benefits'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 170
, 'Manufacturing'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 180
, 'Construction'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 190
, 'Contracting'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 200
, 'Operations'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 210
, 'IT Support'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 220
, 'NOC'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 230
, 'IT Helpdesk'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 240
, 'Government Sales'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 250
, 'Retail Sales'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 260
, 'Recruiting'
, NULL
, 1700
);

INSERT INTO dept_tab VALUES
( 270
, 'Payroll'
, NULL
, 1700
);
44 changes: 44 additions & 0 deletions queries/00_01/insert_emp_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
INSERT INTO emp_tab
VALUES(7001, 'KING', 'PRESIDENT', null,
date('1981-11-17'), 5000, 1000, 40);

INSERT INTO emp_tab
VALUES(7002, 'CLARK', 'MANAGER', 7001,
date('1981-06-09'), 2450, 500, 40
);

INSERT INTO emp_tab
VALUES(7003, 'JONES', 'MANAGER', 7001,
date('1981-04-02'),2975, 500, 30
);

INSERT INTO emp_tab
VALUES(7004, 'SCOTT', 'ANALYST', 7002,
date('1987-08-13'), 3000, 300, 70
);

INSERT INTO emp_tab
VALUES(7005, 'FORD', 'ANALYST', 7002,
date('1981-12-03'),3000, 300, 30
);

INSERT INTO emp_tab
VALUES(7006, 'SMITH', 'CLERK', 7003,
date('1980-12-17'),800, 200, 30
);

INSERT INTO emp_tab
VALUES(7007, 'ADAMS', 'CLERK', 7003,
date('1987-08-13'), 1100, 200, 40
);

INSERT INTO emp_tab
VALUES(
7008, 'MILLER', 'CLERK', 7003,
date('1982-01-23'), 1300, 200, 30
);

DELETE FROM emp_tab WHERE empno=7005;



42 changes: 42 additions & 0 deletions queries/00_01/insert_old_emp_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
INSERT INTO old_emp_tab
VALUES(7001, 'KING', 'PRESIDENT', null,
date('1981-11-17'), 5000, 1000, 40);

INSERT INTO old_emp_tab
VALUES(7002, 'CLARK', 'MANAGER', 7001,
date('1981-06-09'), 2450, 500, 40
);

INSERT INTO old_emp_tab
VALUES(7003, 'JONES', 'MANAGER', 7001,
date('1981-04-02'),2975, 500, 30
);

INSERT INTO old_emp_tab
VALUES(7004, 'SCOTT', 'ANALYST', 7002,
date('1987-08-13'), 3000, 300, 70
);

INSERT INTO old_emp_tab
VALUES(7005, 'FORD', 'ANALYST', 7002,
date('1981-12-03'),3000, 300, 30
);

INSERT INTO old_emp_tab
VALUES(7006, 'SMITH', 'CLERK', 7003,
date('1980-12-17'),800, 200, 30
);

INSERT INTO old_emp_tab
VALUES(7007, 'ADAMS', 'CLERK', 7003,
date('1987-08-13'), 1100, 200, 40
);

INSERT INTO old_emp_tab
VALUES(
7008, 'MILLER', 'CLERK', 7003,
date('1982-01-23'), 1300, 200, 30
);



File renamed without changes.
1 change: 1 addition & 0 deletions queries/00_01/select.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from dept_tab;
2 changes: 2 additions & 0 deletions queries/00_01/selectAll.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- SQLite
SELECT * FROM emp_tab;
12 changes: 12 additions & 0 deletions queries/01_02/ComparisonConditions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SELECT empno, name,hiredate
FROM emp_tab
WHERE name LIKE '_D%';

SELECT * FROM emp_tab
WHERE deptno IN (30,40);

SELECT * FROM emp_tab
WHERE salary BETWEEN 2000 AND 6000;

SELECT empno FROM emp_tab
WHERE manager IS NULL;
8 changes: 8 additions & 0 deletions queries/01_02/LogicalConditions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SELECT * FROM emp_tab
WHERE name LIKE 'S%' AND deptno=30;

SELECT * FROM emp_tab
WHERE name LIKE 'S%' OR deptno=30;

SELECT * FROM emp_tab
WHERE deptno NOT IN(30,40);
5 changes: 5 additions & 0 deletions queries/01_02/ORDERBY.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT * FROM emp_tab
WHERE deptno=30 ORDER BY salary;

SELECT * FROM emp_tab
ORDER BY deptno,salary DESC;
9 changes: 9 additions & 0 deletions queries/01_02/OrderOfPrecedence.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT empno,name,deptno,salary
FROM emp_tab
WHERE deptno=30 OR deptno=40
AND salary>2500;

SELECT empno,name,deptno,salary
FROM emp_tab
WHERE (deptno=30 OR deptno=40)
AND salary>2500;
Loading