diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..1b7efac Binary files /dev/null and b/.DS_Store differ diff --git a/03_MyProjects/1.12_KenyanSalaries/1.12Salaries_ke.sql b/03_MyProjects/1.12_KenyanSalaries/1.12Salaries_ke.sql new file mode 100644 index 0000000..f874464 --- /dev/null +++ b/03_MyProjects/1.12_KenyanSalaries/1.12Salaries_ke.sql @@ -0,0 +1,57 @@ +SELECT LIMIT 100; +FROM job_postings_fact +WHERE job_country = 'Kenya'; + + +SELECT + jpf.job_title_short, + jpf.job_country, +MIN(job_posted_date) as earliestjob, +MAX(job_posted_date) as lastestjob, +MIN(salary_year_avg), +MAX(salary_year_avg), +COUNT (job_title_short) as jobs_available, +FROM job_postings_fact as jpf +WHERE +job_title_short IN ('Data Analyst', 'Data Engineer', 'Data Scientist', 'Business Analyst', 'Senior Data Analyst', 'Senior Data Scientist') +AND job_country = 'Kenya' +AND salary_year_avg is NOT NULL +GROUP BY job_title_short,job_country +ORDER BY jobs_available DESC; + + +SELECT COUNT(*) +FROM +job_postings_fact, +WHERE job_country = 'Kenya' +; + + +SELECT COUNT(*) +FROM +job_postings_fact, +WHERE job_country = 'Kenya' +AND + salary_year_avg IS NULL +; + + + +SELECT + job_title_short, + COUNT(*), + MIN(salary_year_avg) AS Minimun_Annual$, + MAX(salary_year_avg) AS Maximum_Annual$, + ROUND(AVG(salary_year_avg)) AS average_salary +FROM + job_postings_fact, +WHERE job_country = 'Kenya' +AND + salary_year_avg +AND + job_title_short NOT IN ('Software Engineer ') +GROUP BY + job_title_short +ORDER BY + average_salary DESC +; \ No newline at end of file diff --git a/Lessons/1.10/1.10_DataModelling.sql b/Lessons/1.10/1.10_DataModelling.sql new file mode 100644 index 0000000..b3c3071 --- /dev/null +++ b/Lessons/1.10/1.10_DataModelling.sql @@ -0,0 +1,42 @@ +SELECT + job_id, + job_title_short, + salary_year_avg, + company_id +FROM + job_postings_fact +LIMIT 10; + +SELECT + company_id, + name +FROM + company_dim +LIMIT 100; + +SELECT * +FROM information_schema.tables +WHERE + table_catalog='data_jobs'; + +SELECT * +FROM information_schema.columns +WHERE + table_catalog='data_jobs'; + + +SELECT * +FROM information_schema.table_constraints +WHERE + table_catalog= 'data_jobs' +AND + constraint_type IN ('PRIMARY KEY', 'FOREIGN KEY'); + +SELECT * +FROM information_schema.key_column_usage +WHERE + table_catalog= 'data_jobs'; + +PRAGMA show_tables_expanded; + +DESCRIBE job_postings_fact; \ No newline at end of file diff --git a/Lessons/1.11/1.11_Joins.sql b/Lessons/1.11/1.11_Joins.sql new file mode 100644 index 0000000..0d948a3 --- /dev/null +++ b/Lessons/1.11/1.11_Joins.sql @@ -0,0 +1,122 @@ +SELECT * +FROM job_postings_fact +LIMIT 100; + +SELECT * +FROM company_dim +LIMIT 100; + +SELECT + jdf.job_title_short, + jdf.job_location, + jdf.job_via, + cdm.name +FROM job_postings_fact as jdf +JOIN company_dim as cdm +ON jdf.company_id AND cdm.company_id +LIMIT 100; + +SELECT COUNT(*) +FROM company_dim +WHERE name = 'CELEBe Korea Co., LTD.'; + +SELECT +COUNT(company_id) +FROM job_postings_fact +WHERE company_id = 638608; + +SELECT + jdf.job_title_short, + jdf.job_location, + jdf.job_via, + jdf.company_id, + cdm.company_id, + cdm.name AS companyname +FROM job_postings_fact as jdf +LEFT JOIN company_dim as cdm +ON jdf.company_id AND cdm.company_id +LIMIT 10; + +SELECT * +FROM company_dim +LIMIT 10; + +SELECT * +FROM job_postings_fact +LIMIT 10; + +SELECT + jdm.job_id, + jdm.job_title_short, + jdm.job_location, + jdm.job_via, + cd.company_id, + cd.name +FROM job_postings_fact as jdm +JOIN company_dim as cd +ON jdm.company_id = cd.company_id +LIMIT 20; + + +SELECT * FROM skills_job_dim +LIMIT 10; + +SELECT * FROM job_postings_fact +LIMIT 20; + +SELECT * +FROM information_schema.tables +WHERE table_catalog='data_jobs'; + +SELECT * +FROM information_schema.columns +WHERE table_catalog='data_jobs'; + + +SELECT * +FROM information_schema.columns +WHERE table_catalog = 'data_jobs'; + + +SELECT + jdm.*, +FROM job_postings_fact as jdm +LIMIT 10; + +SELECT + sjm.* +FROM skills_job_dim as sjm +LIMIT 10; + + +-- //////// + +SELECT + sd.* +FROM skills_dim as sd +LIMIT 10; + + +SELECT +cd.* +FROM company_dim as cf; + + + +SELECT + jpf.job_id, + cd.name, + jpf.job_title_short, + jpf.job_location, + jpf.job_country, + sd.skills, + sjd.skill_id +FROM job_postings_fact as jpf +LEFT JOIN skills_job_dim as sjd + ON jpf.job_id = sjd.job_id +LEFT JOIN skills_dim as sd + ON sd.skill_id = sd.skill_id +LEFT JOIN company_dim AS cd + on jpf.company_id = cd.company_id +ORDER BY RANDOM() +LIMIT 20; \ No newline at end of file diff --git a/Lessons/1.9/1.9_VScode_Intro.sql b/Lessons/1.9/1.9_VScode_Intro.sql new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/Lessons/1.9/1.9_VScode_Intro.sql @@ -0,0 +1 @@ + \ No newline at end of file