代写ECS 116、代做SQL设计编程
ECS 116 Databases for Non-Majors / Data Management for Data Science
Programming Assignment 1
A. Prelude
1. The assignment is of 25 points.
2. Last date of submission is April 28, Sunday @ 11:59 pm.
3. Late submissions will be graded according to the late policy. Specifically, 10% of grade is deducted if you are
up to 24 hours late, 20% is deducted if you are 24 to 48 hours late, and no credit if turned in after 48 hours.
4. This assignment will be solo.
5. Create a new sql file for each step namely (Step 2, Step 3, Step 4) if you have to use sql commands through
DBeaver.
6. Your assignment will be graded based on correctness (passing all tests), ingenuity and originality.
7. All the required files (csv) can be found under Files in Canvas.
8. Plagiarism is strictly prohibited. You’re free to discuss high-level concepts amongst your peers. However,
cheating will result in no points on the assignment and reporting to OSSJA.
B. Step 1: Uploading africa fs after cleaning db.csv into PostgreSQL
1. In DBeaver create a new database faostat. Set that as the default database
2. Create a schema food sec (or “food sec v01”) in your database faostat. Set that as default schema.
3. Do set search path to food sec;
4. Load the file africa fs after cleaning db.csv into the schema food sec to make table africa fs ac.
5. Modify the data types of some of the columns of africa fs ac as follows:
area code m49: varchar(3)
element code: varchar(4)
year code: varchar(8)
value: numeric
After making these changes, click on “Save” at bottom of pane.
6. Check whether the values for value column have been imported correctly.
Do a selection query to get distinct values that are ≤ 2.
Using Excel see what are the values ≤ 2.
Do these match?
7. Do an SQL query to DELETE all tuples from africa fs ac (it will ask you to confirm that you want to do this
delete).
8. Use DBeaver to import the file africa fs after cleaning db.csv (don’t use the SQL “COPY” command
because it complains about a data type encoding issue).
Do a sanity check that the number of tuples in your table is same as in csv file.
Again check on the values in column value.
1
C. Step 2: Build Table gdp stunting overweight anemia
1. Similar to the construction of gdp stunting overweight shown in the 2024-04-09 lecture and the SQL script
faostat-part 02-transforming africa fs.sql, use DBeaver and SQL commands to build a table
gdp stunting overweight anemia which has, for each country-year pair the following associated values for:
GDP per capita Purchasing Power Parity (22013): use column name gdp p ppp.
Percentage of children over 5 years of age who are stunted (21025): . childhood stunting
Percentage of children over 5 years of age who are overweight (21043): childhood overweight.
Prevalence of anemia among women of reproductive age: anemia
2. Add this table into your schema food sec.
Figure 1: Almost correct example of the table gdp stunting overweight anemia. Your table should have 3 characters
for area code m49 column, and may have some decimal values for the last 4 columns.
D. Step 3: Build table energy undernourished
1. Note that many records in africa fs ac have year and year code values based on 3-year intervals rather than
single years. We will use some of this data to gain more insight about countries. In particular, we will interpret
a 3-year interval as applying to the year in the middle, e.g., we will interpret 2000-2002 as applying to the year
2001.
2. First, build a table energy undernourished which has, for each country-year code pair the associated values
for:
Average dietary energy supply adequacy (21010): use column name dietary energy.
Prevalence of undernourishment (210041): use column name undernourished.
Note: this table should have 1040 rows in it.
3. Now add a column derived year to the table energy undernourished, where for each tuple, the derived year
value is computed by using the year in the middle of the first and third years in the year code of the tuple.
4. The column you added probably has data type integer. Convert this to varchar(4).
2
Figure 2: Almost correct example of the table energy undernourished. As with Figure 1, the area code m49 column
should have 3 characters, and the values for last 3 columns may have decimal values.
E. Step 4: Joining the gdp stunting overweight anemia and
energy undernourished tables to create new
table gdp energy with fs indicators
1. Create a selection query that combines the table gdp stunting overweight anemia and energy undernourished
to form a new table gdp energy with fs indicators
The columns should include area code m49, area, year code, gdp pc ppp, dietary energy, childhood stunting,
childhood overweight, anemia and undernourished.
Tuples in this table should be formed by combining tuples from gdp stunting overweight anemia and
energy undernourished where year code from the first table equals derived year of the second table.
Note: your table should have 895 tuples in it.
2. Export the table gdp energy with fs indicators as a csv file gdp energy with fs indicators.csv.
3. Sort this csv file by area (country name) and then year code.
4. CONGRATULATIONS: you have created a table that we can use later to determine whether there are sta?tistical correlations between gdp per capita and/or stunting, childhood overweight, anemia in women and/or
undernourishment.
Figure 3: Example of the table gdp energy with fs indicators
5. Create a new table gdp energy fs aggs.
Which has columns as:
– area code m49
– area
– avg gdp pc ppp
– avg dietary energy
3
– avg childhood stunting
– avg childhood overweight
– avg anemia
– avg undernourished
The “avg” columns should hold the averages of the corresponding items for each country, over all of the
years of available data.
Use the round operator on the “avg” value, so that they have type numeric and are rounded to 2 decimal
points. Use the following kind of expression: round(< expression for average >::numeric, 2).
6. Export the table gdp energy fs aggs as a csv file gdp energy fs aggs.csv.
7. Sort the csv file by area (i.e., country name).
Figure 4: Almost correct example of the table gdp energy fs aggs. You will obtain slightly different values. This
table was computed with rounded values for various columns, rather than with values having decimals.
F. Submission
1. Please make a single zip file that includes
gdp energy with fs indicators.csv
gdp energy fs aggs.csv
The DBeaver sql scripts that you used to create these 2 csv files, specifically, Step 2.sql, Step 3.sql,
Step 4.sql).
Name the zip file as FirstName LastName LastFourDigitsOfStudentID ECS116 A1.
2. Upload it on Canvas for Assignment 1 (This is a solo assignment so don’t add your peers to your submission).
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- Ins全球爆粉推广机器人,Instagram采集器助你快速成功!
- 代做HPM 573、代写Java,c++设计程序
- 求臻医学满分通过CAP NGS−B 及CAP NEO-A能力验证!
- WhatsApp拉群营销工具 海外营销高手的神奇法宝 引爆你在国际市场的激情
- Instagram营销软件 - ins采集软件/ig采集助手/ins群发助手
- Instagram营销助手 - ins群发工具/ig营销助手/ins引流神器
- VSP2101YG4: Revolutionizing Video Signal Processing for Enhanced Visual Experiences | ChipsX
- 代做ARM Assembly First Lab、c/c++,Java程序代写
- 创新引爆业绩 WhatsApp拉群营销工具为您的业务开创新的成功篇章
- 世贸通美国投资移民:又一批EB5投资人在移民美国上I-829获批
- 北京爱尔英智眼科丁雪主任教你这样自测白内障,不抓瞎!
- Instagram批量养号工具,Ins自动登录软件,ig群发营销软件
- 不知道如何在WhatsApp拉群上引爆品牌 这个工具一键解决你的烦恼 品牌传播无压力
- 六地联袂 以赛聚才 这场比赛太精彩了
- 农牧机械设备:现代化农牧业的得力助手
- 推广轻松,品牌更生动!商家 ins群发软件协议号,为您的营销保驾护航
- Instagram引流神器 - ins定位采集/ig私信博主/ins批量养号
- 数字交易平台的革新力量
- WhatsApp群发软件/ws群发/ws代发/ws协议号/ws劫持号
- 新声科技举办“声为”方案展示会,中国芯助听器闪耀CMEF
- instagram群发采集神器,高效引流爆粉,助你成为社交达人!
- WhatsApp怎么养号,ws协议号购买/ws群发助手/咨询大轩
- Instagram群发助手 - ins定位采集/ig私信博主/ins批量养号/ig吸客
- 新的Kinaxis达拉斯办公室将领先的供应链「Tech」带入德克萨斯
- Ins群发脚本助手,Instagram一键群发工具,让你打造营销新格局!
- Instagram营销软件,ins如何快速群发/ig精准引流神器推荐/联系大轩测试
- MPM9560QC240AE: Redefining Power Management Efficiency in Electronic Systems | ChipsX
- Instagram采集指定地区用户,ins接粉软件,ig打粉软件
- 年度新品:Fit.Q有机生酮咖啡,高效燃脂健康瘦!
- 从沟通零基础到外贸达人 WhatsApp拉群神器帮我拆除语言障碍
推荐
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技