├── .gitignore ├── .devcontainer ├── setup-postgresql.sql ├── Dockerfile ├── startup.sh ├── docker-compose.yml └── devcontainer.json ├── Exercise Files ├── CH08 │ ├── 08 07.sql │ ├── 08 04.sql │ ├── 08 03.sql │ └── 08 05.sql ├── CH04 │ ├── 04_04.sql │ ├── 04_02.sql │ ├── 04_09.sql │ ├── 04_07.sql │ ├── 04_03.sql │ ├── 04_05.sql │ ├── 04_06.sql │ └── 04_01.sql ├── CH07 │ ├── 07 02.sql │ ├── 07 04.sql │ ├── 07 05.sql │ └── 07 03.sql ├── CH05 │ ├── 05_01.sql │ ├── 05_06.sql │ ├── 05_04.sql │ ├── 05_02.sql │ └── 05_03.sql ├── CH 02 │ ├── 02_08.sql │ ├── 02_03.sql │ ├── 02_05.sql │ ├── 02_06.sql │ └── 02_04.sql ├── CH06 │ ├── 06_06.sql │ ├── 06_05.sql │ ├── 06_03.sql │ ├── 06_02.sql │ └── 06_04.sql └── CH03 │ ├── 03_02.sql │ ├── 03_04.sql │ ├── 03_05.sql │ ├── 03_01.sql │ └── 03_03.sql ├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md ├── workflows │ └── main.yml └── ISSUE_TEMPLATE.md ├── CONTRIBUTING.md ├── NOTICE ├── .vscode └── settings.json ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | .tmp 4 | npm-debug.log 5 | -------------------------------------------------------------------------------- /.devcontainer/setup-postgresql.sql: -------------------------------------------------------------------------------- 1 | -- SQL code to Drop, Create, Insert into the database 2 | -------------------------------------------------------------------------------- /Exercise Files/CH08/08 07.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | id, 3 | response -> 'data' -> 'metadata' ->> 'source' as source 4 | FROM data_sci.api_responses 5 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Codeowners for these exercise files: 2 | # * (asterisk) deotes "all files and folders" 3 | # Example: * @producer @instructor 4 | -------------------------------------------------------------------------------- /Exercise Files/CH08/08 04.sql: -------------------------------------------------------------------------------- 1 | 2 | SELECT 3 | id, 4 | response->'data'->'user'->>'name' as user_name 5 | FROM api_responses 6 | WHERE id = 1; 7 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Exercise Files/CH04/04_04.sql: -------------------------------------------------------------------------------- 1 | select 2 | department_id 3 | from 4 | data_sci.employees e1 5 | where 6 | (select max(salary) from data_sci.employees e2) = e1.salary -------------------------------------------------------------------------------- /Exercise Files/CH07/07 02.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | e.*, 3 | cr.* 4 | FROM 5 | data_sci.employees e 6 | INNER JOIN 7 | data_sci.company_regions cr 8 | on 9 | e.region_id = cr.id -------------------------------------------------------------------------------- /Exercise Files/CH07/07 04.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | e.*, 3 | cr.* 4 | FROM 5 | data_sci.employees e 6 | LEFT OUTER JOIN 7 | data_sci.company_regions cr 8 | on 9 | e.region_id = cr.id -------------------------------------------------------------------------------- /Exercise Files/CH07/07 05.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | e.*, 3 | cr.* 4 | FROM 5 | data_sci.employees e 6 | FULL OUTER JOIN 7 | data_sci.company_regions cr 8 | on 9 | e.region_id = cr.id -------------------------------------------------------------------------------- /Exercise Files/CH05/05_01.sql: -------------------------------------------------------------------------------- 1 | select 2 | department_id, 3 | last_name, 4 | salary, 5 | first_value(salary) over (partition by department_id order by salary asc) first_sal 6 | from 7 | data_sci.employees; 8 | -------------------------------------------------------------------------------- /Exercise Files/CH04/04_02.sql: -------------------------------------------------------------------------------- 1 | select 2 | e1.last_name, 3 | e1.salary, 4 | e1.department_id, 5 | (select avg(salary) from data_sci.employees e2 where e1.department_id = e2.department_id) 6 | from 7 | data_sci.employees e1 -------------------------------------------------------------------------------- /Exercise Files/CH04/04_09.sql: -------------------------------------------------------------------------------- 1 | select 2 | department_id, sum(salary) 3 | from 4 | data_sci.employees 5 | group by 6 | department_id 7 | having 8 | sum(salary) > 5000000 9 | order by 10 | sum(salary) desc 11 | -------------------------------------------------------------------------------- /Exercise Files/CH 02/02_08.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | e.last_name, 3 | e.email, 4 | cd.department_name 5 | FROM 6 | data_sci.employees e 7 | JOIN 8 | data_sci.company_departments cd 9 | ON 10 | e.department_id = cd.id 11 | WHERE 12 | salary > 120000; 13 | -------------------------------------------------------------------------------- /Exercise Files/CH05/05_06.sql: -------------------------------------------------------------------------------- 1 | with east_regions AS 2 | (select id 3 | from data_sci.company_regions cr 4 | where region_name like '%east%') 5 | select sum(salary), 6 | round(avg(salary),2) 7 | from data_sci.employees e2 8 | where e2.region_id in (select id from east_regions) -------------------------------------------------------------------------------- /Exercise Files/CH06/06_06.sql: -------------------------------------------------------------------------------- 1 | with east_regions AS 2 | (select id 3 | from data_sci.company_regions cr 4 | where region_name like '%east%') 5 | select sum(salary), 6 | round(avg(salary),2) 7 | from data_sci.employees e2 8 | where e2.region_id in (select id from east_regions) -------------------------------------------------------------------------------- /Exercise Files/CH04/04_07.sql: -------------------------------------------------------------------------------- 1 | select 2 | * 3 | from 4 | data_sci.employees e 5 | order by 6 | salary desc 7 | limit 10 8 | 9 | select 10 | * 11 | from 12 | data_sci.employees e 13 | order by 14 | salary desc 15 | fetch first 10 rows only -------------------------------------------------------------------------------- /Exercise Files/CH07/07 03.sql: -------------------------------------------------------------------------------- 1 | 2 | insert into data_sci.company_regions values (8, 'london', 'uk'); 3 | commit; 4 | 5 | 6 | SELECT 7 | e.*, 8 | cr.* 9 | FROM 10 | data_sci.employees e 11 | RIGHT OUTER JOIN 12 | data_sci.company_regions cr 13 | on 14 | e.region_id = cr.id -------------------------------------------------------------------------------- /Exercise Files/CH06/06_05.sql: -------------------------------------------------------------------------------- 1 | select 2 | sum(salary), 3 | round(avg(salary),2) 4 | from 5 | data_sci.employees e2 6 | where 7 | e2.region_id in (select id 8 | from data_sci.company_regions cr 9 | where region_name like '%east%') -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Copy To Branches 2 | on: 3 | workflow_dispatch: 4 | jobs: 5 | copy-to-branches: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | with: 10 | fetch-depth: 0 11 | - name: Copy To Branches Action 12 | uses: planetoftheweb/copy-to-branches@v1.2 13 | env: 14 | key: main 15 | -------------------------------------------------------------------------------- /Exercise Files/CH04/04_03.sql: -------------------------------------------------------------------------------- 1 | select 2 | round(avg(salary), 2) 3 | from 4 | data_sci.employees 5 | 6 | 7 | 8 | 9 | 10 | 11 | select 12 | round(avg(e1.salary), 2) 13 | from 14 | (select * from data_sci.employees where salary > 100000) e1 15 | 16 | 17 | 18 | 19 | select 20 | round(avg(e1.salary), 2) 21 | from 22 | data_sci.employees e1 23 | where 24 | salary > 100000 -------------------------------------------------------------------------------- /Exercise Files/CH05/05_04.sql: -------------------------------------------------------------------------------- 1 | select 2 | department_id, 3 | last_name, 4 | salary, 5 | width_bucket(salary,0,150000,10) 6 | from 7 | data_sci.employees 8 | 9 | 10 | 11 | 12 | 13 | 14 | select 15 | department_id, 16 | last_name, 17 | salary, 18 | round((cume_dist() over (order by salary desc) * 100)::numeric, 2) 19 | from 20 | data_sci.employees 21 | order by 22 | salary desc -------------------------------------------------------------------------------- /Exercise Files/CH06/06_03.sql: -------------------------------------------------------------------------------- 1 | drop table if exists data_sci.org_structure; 2 | create table data_sci.org_structure ( 3 | id integer, 4 | department_name text, 5 | parent_department_id integer); 6 | 7 | 8 | insert into data_sci.org_structure values 9 | (1, 'CEO Office', null), 10 | (2, 'VP Sales', 1), 11 | (3, 'VP Operations', 1), 12 | (4, 'Northeast Sales',2), 13 | (5, 'Northwest Sales',2), 14 | (6, 'Infrastructure Operations', 3), 15 | (7, 'Management Operations', 3); -------------------------------------------------------------------------------- /Exercise Files/CH06/06_02.sql: -------------------------------------------------------------------------------- 1 | with region_salaries as 2 | (select 3 | e.region_id, 4 | sum(e.salary) region_salary 5 | from 6 | data_sci.employees e 7 | group by region_id), 8 | top_region_salaries as 9 | (select 10 | region_id 11 | from 12 | region_salaries 13 | where region_salary > (SELECT SUM(region_salary)/7 from region_salaries)) 14 | select 15 | * 16 | from 17 | region_salaries 18 | where 19 | region_id in (SELECT region_id from top_region_salaries) -------------------------------------------------------------------------------- /Exercise Files/CH05/05_02.sql: -------------------------------------------------------------------------------- 1 | select 2 | department_id, 3 | salary, 4 | avg(salary) over (partition by department_id) 5 | from 6 | data_sci.employees; 7 | 8 | 9 | select 10 | department_id, 11 | salary, 12 | ntile(4) over (partition by department_id order by salary desc) as quartile 13 | from 14 | data_sci.employees; 15 | 16 | 17 | 18 | 19 | select 20 | department_id, 21 | last_name, 22 | salary, 23 | nth_value(salary,5) OVER (partition by department_id order by salary desc) 24 | from 25 | data_sci.employees; -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | Contribution Agreement 3 | ====================== 4 | 5 | This repository does not accept pull requests (PRs). All pull requests will be closed. 6 | 7 | However, if any contributions (through pull requests, issues, feedback or otherwise) are provided, as a contributor, you represent that the code you submit is your original work or that of your employer (in which case you represent you have the right to bind your employer). By submitting code (or otherwise providing feedback), you (and, if applicable, your employer) are licensing the submitted code (and/or feedback) to LinkedIn and the open source community subject to the BSD 2-Clause license. 8 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2025 LinkedIn Corporation 2 | All Rights Reserved. 3 | 4 | Licensed under the LinkedIn Learning Exercise File License (the "License"). 5 | See LICENSE in the project root for license information. 6 | 7 | Please note, this project may automatically load third party code from external 8 | repositories (for example, NPM modules, Composer packages, or other dependencies). 9 | If so, such third party code may be subject to other license terms than as set 10 | forth above. In addition, such third party code may also depend on and load 11 | multiple tiers of dependencies. Please review the applicable licenses of the 12 | additional dependencies. 13 | -------------------------------------------------------------------------------- /Exercise Files/CH03/03_02.sql: -------------------------------------------------------------------------------- 1 | 03_02 2 | 3 | 4 | select 5 | 'abcdefghijk' test_string; 6 | 7 | 8 | select 9 | substring('abcdefghijk', 1,3) test_string; 10 | 11 | 12 | select 13 | substring('abcdefghijk' from 1 for 3) test_string; 14 | 15 | 16 | select 17 | substring('abcdefghijk' from 5) test_string; 18 | 19 | 20 | select 21 | * 22 | from 23 | data_sci.employees; 24 | 25 | 26 | 27 | 28 | select 29 | * 30 | from 31 | data_sci.employees 32 | where 33 | job_title like '%assistant%'; 34 | 35 | 36 | 37 | select 38 | job_title, (job_title like '%assistant%') is_assistant 39 | from 40 | data_sci.employees 41 | where 42 | job_title like '%assistant%'; 43 | 44 | -------------------------------------------------------------------------------- /Exercise Files/CH08/08 03.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE data_sci.api_responses ( 2 | id INTEGER PRIMARY KEY, 3 | response JSON 4 | ); 5 | 6 | INSERT INTO data_sci.api_responses (id, response) 7 | VALUES ( 8 | 1, 9 | '{ 10 | "status": "success", 11 | "code": 200, 12 | "data": { 13 | "user": { 14 | "id": 123, 15 | "name": "Jane Doe", 16 | "email": "jd@example.com" 17 | }, 18 | "metadata": { 19 | "timestamp": "2025-01-30T10:30:00Z", 20 | "source": "user_api" 21 | } 22 | } 23 | }' 24 | ); 25 | 26 | 27 | SELECT id, response 28 | FROM data_sci.api_responses 29 | WHERE id = 1; 30 | 31 | 32 | -------------------------------------------------------------------------------- /Exercise Files/CH 02/02_03.sql: -------------------------------------------------------------------------------- 1 | 2 | --- Basic Aggregation Commands 3 | 4 | select 5 | * 6 | from 7 | data_sci.employees; 8 | 9 | select 10 | * 11 | from 12 | data_sci.employees 13 | limit 10; 14 | 15 | select 16 | * 17 | from 18 | data_sci.employees 19 | where 20 | region_id = 2; 21 | 22 | 23 | 24 | select 25 | count(*) 26 | from 27 | data_sci.employees; 28 | 29 | 30 | 31 | select 32 | count(*), min(salary), max(salary) 33 | from 34 | data_sci.employees; 35 | 36 | 37 | select 38 | count(*), min(salary), max(salary) 39 | from 40 | data_sci.employees 41 | where 42 | region_id = 2; 43 | 44 | 45 | select 46 | count(*), min(id), max(id) 47 | from 48 | data_sci.employees; 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Exercise Files/CH 02/02_05.sql: -------------------------------------------------------------------------------- 1 | 2 | 3 | select 4 | last_name, department_id, salary 5 | from 6 | data_sci.employees 7 | where 8 | last_name = 'boyd'; 9 | 10 | 11 | 12 | 13 | select 14 | last_name, department_id, salary 15 | from 16 | data_sci.employees 17 | where 18 | last_name like 'b%'; 19 | 20 | 21 | select 22 | last_name, department_id, salary 23 | from 24 | data_sci.employees 25 | where 26 | last_name like 'b%d'; 27 | 28 | 29 | 30 | select 31 | last_name, department_id, salary 32 | from 33 | data_sci.employees 34 | where 35 | last_name like 'bo%' 36 | or 37 | salary > 100000; 38 | 39 | select 40 | sum(salary) 41 | from 42 | data_sci.employees 43 | where 44 | salary > 100000 45 | group by 46 | department_id; 47 | -------------------------------------------------------------------------------- /Exercise Files/CH08/08 05.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE data_sci.api_responses; 2 | 3 | CREATE TABLE data_sci.api_responses ( 4 | id INTEGER PRIMARY KEY, 5 | response JSONB 6 | ); 7 | 8 | 9 | INSERT INTO data_sci.api_responses (id, response) 10 | VALUES ( 11 | 1, 12 | '{ 13 | "status": "success", 14 | "code": 200, 15 | "data": { 16 | "user": { 17 | "id": 123, 18 | "name": "Jane Doe", 19 | "email": "jd@example.com" 20 | }, 21 | "metadata": { 22 | "timestamp": "2025-01-30T10:30:00Z", 23 | "source": "user_api" 24 | } 25 | } 26 | }' 27 | ); 28 | 29 | CREATE INDEX idx_username ON data_sci.api_responses 30 | ((response->'data'->'user'->>'name')); 31 | -------------------------------------------------------------------------------- /Exercise Files/CH03/03_04.sql: -------------------------------------------------------------------------------- 1 | select 2 | salary 3 | from 4 | data_sci.employees 5 | 6 | 7 | 8 | 9 | select 10 | avg(salary) 11 | from 12 | data_sci.employees 13 | 14 | 15 | 16 | 17 | 18 | 19 | select 20 | trunc( avg(salary)) 21 | from 22 | data_sci.employees 23 | 24 | 25 | 26 | 27 | select 28 | trunc( avg(salary)) 29 | from 30 | data_sci.employees 31 | 32 | 33 | 34 | 35 | select 36 | trunc( avg(salary),2) 37 | from 38 | data_sci.employees 39 | 40 | 41 | select 42 | ceil(avg(salary)) 43 | from 44 | data_sci.employees 45 | 46 | 47 | select 48 | trunc( avg(salary),2) 49 | from 50 | data_sci.employees 51 | 52 | 53 | 54 | 55 | select 56 | trunc( avg(salary),4) 57 | from 58 | data_sci.employees -------------------------------------------------------------------------------- /Exercise Files/CH03/03_05.sql: -------------------------------------------------------------------------------- 1 | create extension if not exists fuzzystrmatch; 2 | 3 | create extension if not exists fuzzystrmatch; 4 | 5 | select 6 | soundex('Postgres'); 7 | 8 | 9 | select 10 | soundex('Postgres'), 11 | soundex('Postgresss'); 12 | 13 | 14 | select 15 | soundex('Postgres'), 16 | soundex('Postgresss'), 17 | ('Postgres' = 'Postgresss'), 18 | soundex('Postgres') = soundex('Postgresss'); 19 | 20 | 21 | select 22 | difference('Postgres','Postgresss'); 23 | 24 | 25 | select 26 | soundex('Postgres'), 27 | soundex('Kostgres'), 28 | difference('Postgres','Kostgres'); 29 | 30 | select 31 | levenshtein('Postgres','Postgres'); 32 | 33 | 34 | select 35 | levenshtein('Postgres','Kostgres'); 36 | 37 | 38 | select 39 | levenshtein('Postgres','mySQL'); -------------------------------------------------------------------------------- /Exercise Files/CH04/04_05.sql: -------------------------------------------------------------------------------- 1 | select 2 | cr.country_name, cr.region_name, count(e.*) 3 | from 4 | data_sci.employees e 5 | join 6 | data_sci.company_regions cr 7 | on 8 | e.region_id = cr.id 9 | group by 10 | cr.country_name, cr.region_name 11 | 12 | 13 | 14 | 15 | 16 | 17 | select 18 | cr.country_name, cr.region_name, count(e.*) 19 | from 20 | data_sci.employees e 21 | join 22 | data_sci.company_regions cr 23 | on 24 | e.region_id = cr.id 25 | group by 26 | rollup(cr.country_name, cr.region_name) 27 | 28 | 29 | 30 | 31 | select 32 | cr.country_name, cr.region_name, count(e.*) 33 | from 34 | data_sci.employees e 35 | join 36 | data_sci.company_regions cr 37 | on 38 | e.region_id = cr.id 39 | group by 40 | rollup(cr.country_name, cr.region_name) 41 | order by 42 | cr.country_name, cr.region_name -------------------------------------------------------------------------------- /Exercise Files/CH06/06_04.sql: -------------------------------------------------------------------------------- 1 | with recursive report_structure(id, department_name,parent_department_id) as 2 | (select id, department_name, parent_department_id 3 | from data_sci.org_structure where id = 7 4 | union 5 | select os.id, os.department_name, os.parent_department_id 6 | from data_sci.org_structure os 7 | join report_structure rs on rs.parent_department_id = os.id 8 | ) 9 | select 10 | * 11 | from report_structure 12 | 13 | 14 | 15 | 16 | with recursive report_structure(id, department_name,parent_department_id) as 17 | (select id, department_name, parent_department_id 18 | from data_sci.org_structure where id = 4 19 | union 20 | select os.id, os.department_name, os.parent_department_id 21 | from data_sci.org_structure os 22 | join report_structure rs on rs.parent_department_id = os.id 23 | ) 24 | select 25 | * 26 | from report_structure -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT=3-bullseye 2 | FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT} 3 | 4 | ENV PYTHONUNBUFFERED 1 5 | 6 | # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 7 | ARG NODE_VERSION="none" 8 | RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi 9 | 10 | RUN apt update && apt install -y postgresql-client 11 | 12 | # [Optional] If your requirements rarely change, uncomment this section to add them to the image. 13 | # COPY requirements.txt /tmp/pip-tmp/ 14 | # RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ 15 | # && rm -rf /tmp/pip-tmp 16 | 17 | # [Optional] Uncomment this section to install additional OS packages. 18 | # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 19 | # && apt-get -y install --no-install-recommends 20 | -------------------------------------------------------------------------------- /Exercise Files/CH04/04_06.sql: -------------------------------------------------------------------------------- 1 | select 2 | cr.country_name, 3 | cr.region_name, 4 | cd.department_name, 5 | count(e.*) 6 | from 7 | data_sci.employees e 8 | join 9 | data_sci.company_regions cr 10 | on 11 | e.region_id = cr.id 12 | join 13 | data_sci.company_departments cd 14 | on 15 | e.department_id = cd.id 16 | group by 17 | cr.country_name, 18 | cr.region_name, 19 | cd.department_name) 20 | order by 21 | cr.country_name, 22 | cr.region_name, 23 | cd.department_name 24 | 25 | 26 | 27 | 28 | select 29 | cr.country_name, 30 | cr.region_name, 31 | cd.department_name, 32 | count(e.*) 33 | from 34 | data_sci.employees e 35 | join 36 | data_sci.company_regions cr 37 | on 38 | e.region_id = cr.id 39 | join 40 | data_sci.company_departments cd 41 | on 42 | e.department_id = cd.id 43 | group by 44 | cube(cr.country_name, 45 | cr.region_name, 46 | cd.department_name) 47 | order by 48 | cr.country_name, 49 | cr.region_name, 50 | cd.department_name -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.bracketPairColorization.enabled": true, 3 | "editor.cursorBlinking": "solid", 4 | "editor.fontFamily": "ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace", 5 | "editor.fontLigatures": false, 6 | "editor.fontSize": 22, 7 | "editor.formatOnPaste": true, 8 | "editor.formatOnSave": true, 9 | "editor.lineNumbers": "on", 10 | "editor.matchBrackets": "always", 11 | "editor.minimap.enabled": false, 12 | "editor.smoothScrolling": true, 13 | "editor.tabSize": 2, 14 | "editor.useTabStops": true, 15 | "emmet.triggerExpansionOnTab": true, 16 | "explorer.openEditors.visible": 0, 17 | "files.autoSave": "afterDelay", 18 | "screencastMode.onlyKeyboardShortcuts": true, 19 | "terminal.integrated.fontSize": 18, 20 | "workbench.activityBar.visible": true, 21 | "workbench.colorTheme": "Visual Studio Dark", 22 | "workbench.fontAliasing": "antialiased", 23 | "workbench.statusBar.visible": true 24 | } 25 | -------------------------------------------------------------------------------- /Exercise Files/CH 02/02_06.sql: -------------------------------------------------------------------------------- 1 | select 2 | * 3 | from 4 | data_sci.employees; 5 | 6 | 7 | select 8 | * 9 | from 10 | data_sci.employees 11 | join 12 | data_sci.company_regions 13 | on 14 | employees.region_id = company_regions.id 15 | 16 | 17 | 18 | 19 | select 20 | e.*, cr.region_name, cr.country_name 21 | from 22 | data_sci.employees e 23 | join 24 | data_sci.company_regions cr 25 | on 26 | e.region_id = cr.id 27 | select 28 | e.*, cr.region_name, cr.country_name 29 | from 30 | data_sci.employees e 31 | join 32 | data_sci.company_regions cr 33 | on 34 | e.region_id = cr.id 35 | where 36 | cr.country_name = 'canada'; 37 | 38 | 39 | select 40 | e.last_name, 41 | e.email, 42 | e.start_date, 43 | e.salary, 44 | e.job_title, 45 | cr.region_name, 46 | cr.country_name 47 | from 48 | data_sci.employees e 49 | join 50 | data_sci.company_regions cr 51 | on 52 | e.region_id = cr.id 53 | select 54 | e.*, cr.region_name, cr.country_name 55 | from 56 | data_sci.employees e 57 | join 58 | data_sci.company_regions cr 59 | on 60 | e.region_id = cr.id 61 | where 62 | cr.country_name = 'canada' 63 | -------------------------------------------------------------------------------- /Exercise Files/CH05/05_03.sql: -------------------------------------------------------------------------------- 1 | select 2 | last_name, 3 | salary, 4 | rank() over (order by salary desc) 5 | from 6 | data_sci.employees; 7 | 8 | 9 | select 10 | department_id, 11 | last_name, 12 | salary, 13 | rank() over (partition by department_id order by salary desc) 14 | from 15 | data_sci.employees; 16 | 17 | 18 | 19 | 20 | select 21 | department_id, 22 | last_name, 23 | salary, 24 | lead(salary) over (partition by department_id order by salary desc) 25 | from 26 | data_sci.employees; 27 | 28 | 29 | 30 | 31 | select 32 | department_id, 33 | last_name, 34 | salary, 35 | lead(salary,3) over (partition by department_id order by salary desc) 36 | from 37 | data_sci.employees; 38 | 39 | 40 | select 41 | department_id, 42 | last_name, 43 | salary, 44 | lag(salary,3) over (partition by department_id order by salary desc) 45 | from 46 | data_sci.employees; 47 | 48 | 49 | select 50 | department_id, 51 | last_name, 52 | salary, 53 | lag(salary) over (partition by department_id order by salary desc) 54 | from 55 | data_sci.employees; -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | ## Issue Overview 9 | 10 | 11 | ## Describe your environment 12 | 13 | 14 | ## Steps to Reproduce 15 | 16 | 1. 17 | 2. 18 | 3. 19 | 4. 20 | 21 | ## Expected Behavior 22 | 23 | 24 | ## Current Behavior 25 | 26 | 27 | ## Possible Solution 28 | 29 | 30 | ## Screenshots / Video 31 | 32 | 33 | ## Related Issues 34 | 35 | -------------------------------------------------------------------------------- /Exercise Files/CH 02/02_04.sql: -------------------------------------------------------------------------------- 1 | 2 | --- Other Aggregates: Average, Variance and Standard Deviation 3 | 4 | 5 | select 6 | * 7 | from 8 | data_sci.employees; 9 | 10 | 11 | select 12 | * 13 | from 14 | data_sci.employees; 15 | limit 10; 16 | 17 | 18 | select 19 | sum(salary) 20 | from 21 | data_sci.employees; 22 | 23 | select 24 | department_id, sum(salary) 25 | from 26 | data_sci.employees 27 | group by department_id; 28 | 29 | 30 | select 31 | department_id, sum(salary), avg(salary) 32 | from 33 | data_sci.employees 34 | group by department_id; 35 | 36 | 37 | select 38 | department_id, sum(salary), round(avg(salary),2) 39 | from 40 | data_sci.employees 41 | group by department_id; 42 | 43 | --- need pickup, variance not variable 44 | select 45 | department_id, sum(salary), round(avg(salary),2), var_pop(salary) 46 | from 47 | data_sci.employees 48 | group by department_id; 49 | 50 | select 51 | department_id, sum(salary), round(avg(salary),2), var_pop(salary), stddev_pop(salary) 52 | from 53 | data_sci.employees 54 | group by department_id; 55 | 56 | -- pickup 68% 1 std, 95% 2 std 57 | -- need video pickup wth round(stddev_pop(salary),2) 58 | select 59 | department_id, 60 | sum(salary), 61 | round(avg(salary),2), 62 | var_pop(salary), 63 | round(stddev_pop(salary),2) 64 | from 65 | data_sci.employees 66 | group by department_id; 67 | 68 | -------------------------------------------------------------------------------- /.devcontainer/startup.sh: -------------------------------------------------------------------------------- 1 | # Run an initial setup script for the MariaDB database 2 | # if [ -f .devcontainer/setup-postgresql.sql ]; then 3 | # psql -h 127.0.0.1 -U postgres postgres < .devcontainer/setup-postgresql.sql 4 | # fi 5 | 6 | 7 | #!/bin/bash 8 | 9 | # Start PostgreSQL service 10 | service postgresql start 11 | 12 | # Wait for PostgreSQL to start (you might adjust the sleep time as necessary) 13 | sleep 5 14 | 15 | # Check if the SQL setup file exists and run it 16 | if [ -f .devcontainer/setup-postgresql.sql ]; then 17 | sleep 20 18 | echo "Executing PostgreSQL setup script..." 19 | # Replace 'postgres' with your actual username and 'postgres' with your database name if needed 20 | psql -h 127.0.0.1 -U postgres -d postgres -f .devcontainer/setup-postgresql.sql 21 | 22 | if [ $? -eq 0 ]; then 23 | echo "PostgreSQL setup script executed successfully." 24 | else 25 | echo "Error executing PostgreSQL setup script." 26 | exit 1 27 | fi 28 | else 29 | echo "SQL setup file not found." 30 | fi 31 | 32 | # Optionally, run your GeoJSON setup script 33 | #if [ -f .devcontainer/setup-geojson.py ]; then 34 | # sleep 20 35 | # echo "Loading GeoJSON data..." 36 | # python3 .devcontainer/setup-geojson.py 37 | 38 | # if [ $? -eq 0 ]; then 39 | # echo "GeoJSON data loaded successfully." 40 | # else 41 | # echo "Error loading GeoJSON data." 42 | # exit 1 43 | # fi 44 | #else 45 | # echo "GeoJSON setup script not found." 46 | #fi 47 | 48 | echo "Startup script completed." 49 | -------------------------------------------------------------------------------- /Exercise Files/CH03/03_01.sql: -------------------------------------------------------------------------------- 1 | select 2 | * 3 | from 4 | data_sci.company_departments; 5 | 6 | 7 | 8 | select 9 | upper(department_name) 10 | from 11 | data_sci.company_departments; 12 | 13 | 14 | select 15 | initcap(department_name) 16 | from 17 | data_sci.company_departments; 18 | 19 | 20 | select 21 | lower(initcap(department_name)) 22 | from 23 | data_sci.company_departments; 24 | 25 | 26 | 27 | 28 | select 29 | ' kelly'; 30 | 31 | select 32 | ' kelly' = 'kelly'; 33 | 34 | 35 | 36 | select 37 | ltrim(' kelly'); 38 | 39 | 40 | 41 | select 42 | ltrim(' kelly') = 'kelly'; 43 | 44 | 45 | 46 | select 47 | ltrim(' kelly ') = 'kelly'; 48 | 49 | 50 | 51 | select 52 | rtrim(ltrim(' kelly ')) = 'kelly'; 53 | 54 | 55 | select 56 | job_title || last_name 57 | from 58 | data_sci.employees; 59 | 60 | 61 | select 62 | job_title || '-' || last_name 63 | from 64 | data_sci.employees; 65 | 66 | 67 | select 68 | job_title || '-' || null 69 | from 70 | data_sci.employees; 71 | 72 | 73 | select 74 | concat(job_title, '-',last_name) 75 | from 76 | data_sci.employees; 77 | 78 | 79 | 80 | select 81 | concat(job_title, '-',null) 82 | from 83 | data_sci.employees; 84 | 85 | 86 | select 87 | concat_ws('-', job_title, last_name) 88 | from 89 | data_sci.employees; 90 | 91 | 92 | select 93 | concat_ws('-', job_title, last_name,email) 94 | from 95 | data_sci.employees; -------------------------------------------------------------------------------- /.devcontainer/docker-compose.yml: -------------------------------------------------------------------------------- 1 | 2 | version: '3.8' 3 | 4 | services: 5 | app: 6 | build: 7 | context: .. 8 | dockerfile: .devcontainer/Dockerfile 9 | args: 10 | # Update 'VARIANT' to pick a version of Python: 3, 3.10, 3.9, 3.8, 3.7, 3.6 11 | # Append -bullseye or -buster to pin to an OS version. 12 | # Use -bullseye variants on local arm64/Apple Silicon. 13 | VARIANT: 3-bullseye 14 | # Optional Node.js version to install 15 | NODE_VERSION: "lts/*" 16 | 17 | volumes: 18 | - ..:/workspace:cached 19 | 20 | # Overrides default command so things don't shut down after the process ends. 21 | command: sleep infinity 22 | 23 | # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. 24 | network_mode: service:db 25 | 26 | # Uncomment the next line to use a non-root user for all processes. 27 | # user: vscode 28 | 29 | # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. 30 | # (Adding the "ports" property to this file will not forward from a Codespace.) 31 | 32 | # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. 33 | # (Adding the "ports" property to this file will not forward from a Codespace.) 34 | 35 | db: 36 | image: postgis/postgis:latest 37 | restart: unless-stopped 38 | volumes: 39 | - postgres-data:/var/lib/postgresql/data 40 | environment: 41 | POSTGRES_USER: postgres 42 | POSTGRES_DB: postgres 43 | POSTGRES_PASSWORD: postgres 44 | 45 | volumes: 46 | postgres-data: 47 | -------------------------------------------------------------------------------- /Exercise Files/CH03/03_03.sql: -------------------------------------------------------------------------------- 1 | select 2 | job_title 3 | from 4 | data_sci.employees; 5 | 6 | 7 | select distinct 8 | job_title 9 | from 10 | data_sci.employees 11 | where 12 | job_title like 'vp%'; 13 | 14 | 15 | select distinct 16 | job_title 17 | from 18 | data_sci.employees 19 | where 20 | job_title like 'vp%' 21 | or 22 | job_title like 'web%'; 23 | 24 | 25 | select distinct 26 | job_title 27 | from 28 | data_sci.employees 29 | where 30 | job_title similar to '(vp%|web%)'; 31 | 32 | 33 | select distinct 34 | job_title 35 | from 36 | data_sci.employees 37 | where 38 | job_title similar to '(vp% | web%)'; 39 | 40 | 41 | 42 | select distinct 43 | job_title 44 | from 45 | data_sci.employees 46 | where 47 | job_title similar to '(vp%|web%)'; 48 | 49 | 50 | select distinct 51 | job_title 52 | from 53 | data_sci.employees 54 | where 55 | job_title similar to 'vp%'; 56 | 57 | 58 | select distinct 59 | job_title 60 | from 61 | data_sci.employees 62 | where 63 | job_title similar to 'vp%a'; 64 | 65 | 66 | 67 | 68 | select distinct 69 | job_title 70 | from 71 | data_sci.employees 72 | where 73 | job_title similar to 'vp%a%'; 74 | 75 | 76 | select distinct 77 | job_title 78 | from 79 | data_sci.employees 80 | where 81 | job_title similar to 'vp a%'; 82 | 83 | 84 | 85 | select distinct 86 | job_title 87 | from 88 | data_sci.employees 89 | where 90 | job_title similar to 'vp_a%'; 91 | 92 | 93 | select distinct 94 | job_title 95 | from 96 | data_sci.employees 97 | where 98 | job_title similar to 'vp (a|m)'; 99 | 100 | 101 | select distinct 102 | job_title 103 | from 104 | data_sci.employees 105 | where 106 | job_title similar to 'vp (a|m)%'; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Intermediate SQL for Data Scientists 2 | This is the repository for the LinkedIn Learning course Intermediate SQL for Data Scientists. The full course is available from [LinkedIn Learning][lil-course-url]. 3 | 4 | ![lil-thumbnail-url] 5 | 6 | ## Course Description 7 | 8 |

Organizations are increasingly adopting digital transformation strategies that lead to greater data generation and, as a result, a greater need for data analysis. This course is designed for analysts and data scientists who work with SQL databases. Instructor Dan Sullivan outlines how to perform common data science tasks, including finding, exploring, and extracting data within relational databases. Explore the basics of using aggregates, statistical functions, window operations, regular expressions, and subqueries. Along the way, learn how to use JSON, a semistructured data type, and perform join operations to enable more complex queries.

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 “Using GitHub Codespaces" with this course to learn how to get started.

9 | 10 | ## Instructor 11 | 12 | Dan Sullivan 13 | 14 | Data Architect, Author, and Instructor 15 | 16 | 17 | 18 | Check out my other courses on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/dan-sullivan?u=104). 19 | 20 | [0]: # (Replace these placeholder URLs with actual course URLs) 21 | 22 | [lil-course-url]: https://www.linkedin.com/learning/intermediate-sql-for-data-scientists-25322592 23 | [lil-thumbnail-url]: https://media.licdn.com/dms/image/v2/D4E0DAQG4LvxcWRlOYQ/learning-public-crop_675_1200/B4EZUghCgXG0AY-/0/1740007287506?e=2147483647&v=beta&t=M8ue0_cYqF--_BbExv7im3immNCMf4V04Mvpow2fWoM 24 | 25 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // Update the VARIANT arg in docker-compose.yml to pick a Python version 2 | { 3 | "name": "Python 3 & PostgreSQL", 4 | "dockerComposeFile": "docker-compose.yml", 5 | "service": "app", 6 | "workspaceFolder": "/workspace", 7 | // Configure tool-specific properties. 8 | "customizations": { 9 | // Configure properties specific to VS Code. 10 | "vscode": { 11 | // Set *default* container specific settings.json values on container create. 12 | "settings": { 13 | "python.defaultInterpreterPath": "/usr/local/bin/python", 14 | "python.linting.enabled": true, 15 | "python.linting.pylintEnabled": true, 16 | "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", 17 | "python.formatting.blackPath": "/usr/local/py-utils/bin/black", 18 | "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", 19 | "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", 20 | "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", 21 | "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", 22 | "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", 23 | "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", 24 | "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", 25 | "python.testing.pytestPath": "/usr/local/py-utils/bin/pytest", 26 | "python.linting.pylintArgs": [ 27 | "--disable=C0111" 28 | ] 29 | }, 30 | // Add the IDs of extensions you want installed when the container is created. 31 | "extensions": [ 32 | "ms-python.python", 33 | "ms-python.vscode-pylance", 34 | "mtxr.sqltools", 35 | "mtxr.sqltools-driver-pg" 36 | ] 37 | } 38 | }, 39 | 40 | // Use 'postCreateCommand' to run commands after the container is created. 41 | // "postCreateCommand": "pip install --user -r requirements.txt", 42 | "postCreateCommand": "sudo sh .devcontainer/startup.sh", 43 | // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 44 | "remoteUser": "vscode", 45 | "onCreateCommand": "echo PS1='\"$ \"' >> ~/.bashrc" //Set Terminal Prompt to $ 46 | } 47 | -------------------------------------------------------------------------------- /Exercise Files/CH04/04_01.sql: -------------------------------------------------------------------------------- 1 | select 2 | cd.department_name, count(*) 3 | from 4 | data_sci.employees e 5 | join 6 | data_sci.company_departments cd 7 | on 8 | e.department_id = cd.id 9 | group by 10 | cd.department_name 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | select 20 | cd.department_name, count(*) 21 | from 22 | data_sci.employees e 23 | join 24 | data_sci.company_departments cd 25 | on 26 | e.department_id = cd.id 27 | group by 28 | cd.department_name 29 | order by 30 | cd.department_name 31 | 32 | 33 | 34 | 35 | select 36 | cd.department_name, count(*) 37 | from 38 | data_sci.employees e 39 | join 40 | data_sci.company_departments cd 41 | on 42 | e.department_id = cd.id 43 | group by 44 | cd.department_name 45 | order by 46 | count(*) 47 | 48 | 49 | 50 | 51 | select 52 | cd.department_name, count(*) 53 | from 54 | data_sci.employees e 55 | join 56 | data_sci.company_departments cd 57 | on 58 | e.department_id = cd.id 59 | group by 60 | cd.department_name 61 | order by 62 | count(*) desc 63 | 64 | 65 | 66 | 67 | select 68 | cd.department_name, count(*) 69 | from 70 | data_sci.employees e 71 | join 72 | data_sci.company_departments cd 73 | on 74 | e.department_id = cd.id 75 | group by 76 | cd.department_name 77 | order by 78 | 1 desc 79 | 80 | 81 | select 82 | cd.department_name, count(*) 83 | from 84 | data_sci.employees e 85 | join 86 | data_sci.company_departments cd 87 | on 88 | e.department_id = cd.id 89 | group by 90 | cd.department_name 91 | order by 92 | 2 desc 93 | 94 | 95 | select 96 | cd.department_name, count(*) 97 | from 98 | data_sci.employees e 99 | join 100 | data_sci.company_departments cd 101 | on 102 | e.department_id = cd.id 103 | group by 104 | cd.department_name 105 | order by 106 | cd.department_name 107 | 108 | 109 | --- this will generate an error 110 | select 111 | cd.department_name, count(*) 112 | from 113 | data_sci.employees e 114 | join 115 | data_sci.company_departments cd 116 | on 117 | e.department_id = cd.id 118 | where 119 | count(*) > 50 120 | group by 121 | cd.department_name 122 | order by 123 | cd.department_name 124 | 125 | 126 | 127 | 128 | 129 | 130 | select 131 | cd.department_name, count(*) 132 | from 133 | data_sci.employees e 134 | join 135 | data_sci.company_departments cd 136 | on 137 | e.department_id = cd.id 138 | group by 139 | cd.department_name 140 | having 141 | count(*) > 50 142 | order by 143 | cd.department_name -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LinkedIn Learning Exercise Files License Agreement 2 | ================================================== 3 | 4 | This License Agreement (the "Agreement") is a binding legal agreement 5 | between you (as an individual or entity, as applicable) and LinkedIn 6 | Corporation (“LinkedIn”). By downloading or using the LinkedIn Learning 7 | exercise files in this repository (“Licensed Materials”), you agree to 8 | be bound by the terms of this Agreement. If you do not agree to these 9 | terms, do not download or use the Licensed Materials. 10 | 11 | 1. License. 12 | - a. Subject to the terms of this Agreement, LinkedIn hereby grants LinkedIn 13 | members during their LinkedIn Learning subscription a non-exclusive, 14 | non-transferable copyright license, for internal use only, to 1) make a 15 | reasonable number of copies of the Licensed Materials, and 2) make 16 | derivative works of the Licensed Materials for the sole purpose of 17 | practicing skills taught in LinkedIn Learning courses. 18 | - b. Distribution. Unless otherwise noted in the Licensed Materials, subject 19 | to the terms of this Agreement, LinkedIn hereby grants LinkedIn members 20 | with a LinkedIn Learning subscription a non-exclusive, non-transferable 21 | copyright license to distribute the Licensed Materials, except the 22 | Licensed Materials may not be included in any product or service (or 23 | otherwise used) to instruct or educate others. 24 | 25 | 2. Restrictions and Intellectual Property. 26 | - a. You may not to use, modify, copy, make derivative works of, publish, 27 | distribute, rent, lease, sell, sublicense, assign or otherwise transfer the 28 | Licensed Materials, except as expressly set forth above in Section 1. 29 | - b. Linkedin (and its licensors) retains its intellectual property rights 30 | in the Licensed Materials. Except as expressly set forth in Section 1, 31 | LinkedIn grants no licenses. 32 | - c. You indemnify LinkedIn and its licensors and affiliates for i) any 33 | alleged infringement or misappropriation of any intellectual property rights 34 | of any third party based on modifications you make to the Licensed Materials, 35 | ii) any claims arising from your use or distribution of all or part of the 36 | Licensed Materials and iii) a breach of this Agreement. You will defend, hold 37 | harmless, and indemnify LinkedIn and its affiliates (and our and their 38 | respective employees, shareholders, and directors) from any claim or action 39 | brought by a third party, including all damages, liabilities, costs and 40 | expenses, including reasonable attorneys’ fees, to the extent resulting from, 41 | alleged to have resulted from, or in connection with: (a) your breach of your 42 | obligations herein; or (b) your use or distribution of any Licensed Materials. 43 | 44 | 3. Open source. This code may include open source software, which may be 45 | subject to other license terms as provided in the files. 46 | 47 | 4. Warranty Disclaimer. LINKEDIN PROVIDES THE LICENSED MATERIALS ON AN “AS IS” 48 | AND “AS AVAILABLE” BASIS. LINKEDIN MAKES NO REPRESENTATION OR WARRANTY, 49 | WHETHER EXPRESS OR IMPLIED, ABOUT THE LICENSED MATERIALS, INCLUDING ANY 50 | REPRESENTATION THAT THE LICENSED MATERIALS WILL BE FREE OF ERRORS, BUGS OR 51 | INTERRUPTIONS, OR THAT THE LICENSED MATERIALS ARE ACCURATE, COMPLETE OR 52 | OTHERWISE VALID. TO THE FULLEST EXTENT PERMITTED BY LAW, LINKEDIN AND ITS 53 | AFFILIATES DISCLAIM ANY IMPLIED OR STATUTORY WARRANTY OR CONDITION, INCLUDING 54 | ANY IMPLIED WARRANTY OR CONDITION OF MERCHANTABILITY OR FITNESS FOR A 55 | PARTICULAR PURPOSE, AVAILABILITY, SECURITY, TITLE AND/OR NON-INFRINGEMENT. 56 | YOUR USE OF THE LICENSED MATERIALS IS AT YOUR OWN DISCRETION AND RISK, AND 57 | YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE THAT RESULTS FROM USE OF THE 58 | LICENSED MATERIALS TO YOUR COMPUTER SYSTEM OR LOSS OF DATA. NO ADVICE OR 59 | INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM US OR THROUGH OR 60 | FROM THE LICENSED MATERIALS WILL CREATE ANY WARRANTY OR CONDITION NOT 61 | EXPRESSLY STATED IN THESE TERMS. 62 | 63 | 5. Limitation of Liability. LINKEDIN SHALL NOT BE LIABLE FOR ANY INDIRECT, 64 | INCIDENTAL, SPECIAL, PUNITIVE, CONSEQUENTIAL OR EXEMPLARY DAMAGES, INCLUDING 65 | BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER 66 | INTANGIBLE LOSSES . IN NO EVENT WILL LINKEDIN'S AGGREGATE LIABILITY TO YOU 67 | EXCEED $100. THIS LIMITATION OF LIABILITY SHALL: 68 | - i. APPLY REGARDLESS OF WHETHER (A) YOU BASE YOUR CLAIM ON CONTRACT, TORT, 69 | STATUTE, OR ANY OTHER LEGAL THEORY, (B) WE KNEW OR SHOULD HAVE KNOWN ABOUT 70 | THE POSSIBILITY OF SUCH DAMAGES, OR (C) THE LIMITED REMEDIES PROVIDED IN THIS 71 | SECTION FAIL OF THEIR ESSENTIAL PURPOSE; AND 72 | - ii. NOT APPLY TO ANY DAMAGE THAT LINKEDIN MAY CAUSE YOU INTENTIONALLY OR 73 | KNOWINGLY IN VIOLATION OF THESE TERMS OR APPLICABLE LAW, OR AS OTHERWISE 74 | MANDATED BY APPLICABLE LAW THAT CANNOT BE DISCLAIMED IN THESE TERMS. 75 | 76 | 6. Termination. This Agreement automatically terminates upon your breach of 77 | this Agreement or termination of your LinkedIn Learning subscription. On 78 | termination, all licenses granted under this Agreement will terminate 79 | immediately and you will delete the Licensed Materials. Sections 2-7 of this 80 | Agreement survive any termination of this Agreement. LinkedIn may discontinue 81 | the availability of some or all of the Licensed Materials at any time for any 82 | reason. 83 | 84 | 7. Miscellaneous. This Agreement will be governed by and construed in 85 | accordance with the laws of the State of California without regard to conflict 86 | of laws principles. The exclusive forum for any disputes arising out of or 87 | relating to this Agreement shall be an appropriate federal or state court 88 | sitting in the County of Santa Clara, State of California. If LinkedIn does 89 | not act to enforce a breach of this Agreement, that does not mean that 90 | LinkedIn has waived its right to enforce this Agreement. The Agreement does 91 | not create a partnership, agency relationship, or joint venture between the 92 | parties. Neither party has the power or authority to bind the other or to 93 | create any obligation or responsibility on behalf of the other. You may not, 94 | without LinkedIn’s prior written consent, assign or delegate any rights or 95 | obligations under these terms, including in connection with a change of 96 | control. Any purported assignment and delegation shall be ineffective. The 97 | Agreement shall bind and inure to the benefit of the parties, their respective 98 | successors and permitted assigns. If any provision of the Agreement is 99 | unenforceable, that provision will be modified to render it enforceable to the 100 | extent possible to give effect to the parties’ intentions and the remaining 101 | provisions will not be affected. This Agreement is the only agreement between 102 | you and LinkedIn regarding the Licensed Materials, and supersedes all prior 103 | agreements relating to the Licensed Materials. 104 | 105 | Last Updated: March 2019 106 | --------------------------------------------------------------------------------