SQLite UN Goals


Let’s make a SQLite database of the 17 United Nations Sustainable Development Goals and some social issues.

1CREATE TABLE UNGoals (
2    id INTEGER PRIMARY KEY,
3    goal_name TEXT NOT NULL,
4    explanation TEXT
5);
6INSERT INTO UNGoals (id, goal_name, explanation) VALUES
7(1, 'No Poverty', 'End poverty in all its forms everywhere.'),
8(2, 'Zero Hunger', 'End hunger, achieve food security and improved nutrition and promote sustainable agriculture.'),
9(3, 'Good Health and Well-being', 'Ensure healthy lives and promote well-being for all at all ages.'),
10(4, 'Quality Education', 'Ensure inclusive and equitable quality education and promote lifelong learning opportunities for all.'),
11(5, 'Gender Equality', 'Achieve gender equality and empower all women and girls.'),
12(6, 'Clean Water and Sanitation', 'Ensure availability and sustainable management of water and sanitation for all.'),
13(7, 'Affordable and Clean Energy', 'Ensure access to affordable, reliable, sustainable and modern energy for all.'),
14(8, 'Decent Work and Economic Growth', 'Promote sustained, inclusive and sustainable economic growth, full and productive employment and decent work for all.'),
15(9, 'Industry, Innovation and Infrastructure', 'Build resilient infrastructure, promote inclusive and sustainable industrialization and foster innovation.'),
16(10, 'Reduced Inequality', 'Reduce inequality within and among countries.'),
17(11, 'Sustainable Cities and Communities', 'Make cities and human settlements inclusive, safe, resilient and sustainable.'),
18(12, 'Responsible Consumption and Production', 'Ensure sustainable consumption and production patterns.'),
19(13, 'Climate Action', 'Take urgent action to combat climate change and its impacts.'),
20(14, 'Life Below Water', 'Conserve and sustainably use the oceans, seas and marine resources for sustainable development.'),
21(15, 'Life on Land', 'Protect, restore and promote sustainable use of terrestrial ecosystems, sustainably manage forests, combat desertification, and halt and reverse land degradation and halt biodiversity loss.'),
22(16, 'Peace, Justice and Strong Institutions', 'Promote peaceful and inclusive societies for sustainable development, provide access to justice for all and build effective, accountable and inclusive institutions at all levels.'),
23(17, 'Partnerships for the Goals', 'Strengthen the means of implementation and revitalize the global partnership for sustainable development.');
24 
25CREATE TABLE Social_Issues (
26    id INTEGER PRIMARY KEY,
27    name TEXT UNIQUE NOT NULL,
28    description TEXT
29);
30-- Insert Social Issues
31INSERT INTO Social_Issues (name, description) VALUES
32    ('Affordable Housing', 'Ensuring people have access to safe, affordable living spaces.'),
33    ('Employment', 'Providing job opportunities and workforce development.'),
34    ('Food Security', 'Ensuring access to nutritious food for all.'),
35    ('Water Access', 'Providing reliable clean water supply.'),
36    ('Sanitation', 'Improving hygiene and waste management to prevent disease.'),
37    ('Environmental Sustainability', 'Promoting eco-friendly practices and conservation efforts.'),
38    ('Healthcare Access', 'Ensuring people have access to essential medical services.'),
39    ('Education Equity', 'Providing equal learning opportunities for all individuals.'),
40    ('Mental Health Support', 'Addressing psychological well-being and access to mental health services.'),
41    ('Financial Inclusion', 'Ensuring access to financial services for underserved populations.'),
42    ('Digital Divide', 'Bridging gaps in technology access and digital literacy.'),
43    ('Gender Equality', 'Promoting equal rights and opportunities regardless of gender.'),
44    ('Indigenous Rights', 'Advancing the rights and well-being of Indigenous communities.'),
45    ('Climate Change Adaptation', 'Helping communities adjust to environmental changes.'),
46    ('Youth Empowerment', 'Supporting young people with education, training, and leadership opportunities.'),
47    ('Disability Inclusion', 'Ensuring accessibility and equal opportunities for people with disabilities.'),
48    ('Refugee Support', 'Providing assistance and resources for displaced populations.'),
49    ('Civic Engagement', 'Encouraging participation in social and political processes.'),
50    ('Employment Equity', 'Promoting fair and inclusive work opportunities.'),
51    ('Senior Support', 'Addressing the needs and well-being of elderly populations.'),
52    ('Prisoner Reintegration', 'Helping formerly incarcerated individuals transition back into society.'),
53    ('Human Trafficking Prevention', 'Combating forced labor and exploitation.'),
54    ('LGBTQ+ Rights', 'Advocating for equal rights and protections for LGBTQ+ individuals.'),
55    ('Addiction Recovery', 'Providing support for individuals struggling with substance abuse.'),
56    ('Disaster Relief', 'Providing emergency aid and long-term recovery support for affected communities.'),
57    ('Rural Development', 'Improving infrastructure and opportunities in rural areas.'),
58    ('Urban Poverty', 'Addressing social and economic challenges in low-income urban areas.'),
59    ('Fair Trade & Ethical Sourcing', 'Promoting fair wages and responsible supply chains.'),
60    ('Child Protection', 'Preventing abuse, exploitation, and neglect of children.'),
61    ('Access to Justice', 'Ensuring legal representation and rights protection for marginalized groups.');
62 
63-- Linking table:
64-- goal_id references a specific UN goal.
65-- issue_id references a specific social issue.
66-- The combination of both columns forms the composite primary key, ensuring no duplicate links.
67-- FOREIGN KEY constraints maintain referential integrity with the UNGoals and Social_Issues tables.
68CREATE TABLE Goal_Issue_Link (
69    goal_id INTEGER NOT NULL,
70    issue_id INTEGER NOT NULL,
71    PRIMARY KEY (goal_id, issue_id),
72    FOREIGN KEY (goal_id) REFERENCES UNGoals(id),
73    FOREIGN KEY (issue_id) REFERENCES Social_Issues(id)
74);
75-- Goal 1: No Poverty
76INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
77(1, 1),  -- Affordable Housing
78(1, 2),  -- Employment
79(1, 26), -- Urban Poverty
80(1, 25); -- Rural Development
81-- Goal 2: Zero Hunger
82INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
83(2, 3),  -- Food Security
84(2, 25); -- Rural Development
85-- Goal 3: Good Health and Well-being
86INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
87(3, 7),  -- Healthcare Access
88(3, 9),  -- Mental Health Support
89(3, 23), -- Addiction Recovery
90(3, 5);  -- Sanitation
91-- Goal 4: Quality Education
92INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
93(4, 8),  -- Education Equity
94(4, 15), -- Youth Empowerment
95(4, 10); -- Digital Divide
96-- Goal 5: Gender Equality
97INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
98(5, 12), -- Gender Equality
99(5, 22); -- LGBTQ+ Rights
100-- Goal 6: Clean Water and Sanitation
101INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
102(6, 4),  -- Water Access
103(6, 5);  -- Sanitation
104-- Goal 7: Affordable and Clean Energy
105-- (Could relate to rural development and sustainability)
106INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
107(7, 6),  -- Environmental Sustainability
108(7, 25); -- Rural Development
109-- Goal 8: Decent Work and Economic Growth
110INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
111(8, 2),  -- Employment
112(8, 19), -- Employment Equity
113(8, 10); -- Digital Divide
114-- Goal 9: Industry, Innovation and Infrastructure
115INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
116(9, 10), -- Digital Divide
117(9, 25); -- Rural Development
118-- Goal 10: Reduced Inequality
119INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
120(10, 12), -- Gender Equality
121(10, 16), -- Disability Inclusion
122(10, 22), -- LGBTQ+ Rights
123(10, 13); -- Indigenous Rights
124-- Goal 11: Sustainable Cities and Communities
125INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
126(11, 1),  -- Affordable Housing
127(11, 5),  -- Sanitation
128(11, 26); -- Urban Poverty
129-- Goal 12: Responsible Consumption and Production
130INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
131(12, 6),  -- Environmental Sustainability
132(12, 27); -- Fair Trade & Ethical Sourcing
133-- Goal 13: Climate Action
134INSERT INTO Goal_Issue_Link (goal_id, issue_id) VALUES
135(13, 6),  -- Environmental Sustainability

Leave a Reply