
Review SQL+ Pandas
Authored by Brigita Ma
Computers
Professional Development
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
Perhatikan tabel country di gambar. Apakah output dari query berikut:
SELECT Continent, COUNT(REGION) AS jumlah_region FROM country
WHERE jumlah_region>5
GROUP BY Continent
ORDER BY jumlah_region;
Benua yang memiliki jumlah negara lebih dari 5.
Tidak ada karena error.
Benua yang memiliki jumlah region lebih dari 5.
Benua yang memiliki jumlah negara lebih dari 5 diurutkan dari yang jumlah negaranya paling kecil
2.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
Perhatikan tabel country dan tabel city di gambar. Manakah query yang sesuai untuk menampilkan jumlah distrik di negara-negara benua Asia, diurutkan dari yang paling banyak.
SELECT country.name AS Negara, COUNT(DISTINCT(district)) AS jumlah_district
FROM country, city WHERE country.code=city.countrycode AND continent='Asia'
GROUP BY country.continent;
SELECT country.name AS Negara, COUNT(DISTINCT(district)) AS jumlah_district
FROM country JOIN city
ON country.code=city.countrycode
WHERE continent='Asia'
GROUP BY country.name
ORDER BY jumlah_district DESC;
SELECT country.name AS Negara, COUNT(DISTINCT(district)) AS jumlah_district
FROM country JOIN city
ON country.code=city.countrycode
WHERE continent='Asia'
GROUP BY country.name
ORDER BY jumlah_district;
SELECT country.name AS Negara, COUNT(DISTINCT(district)) AS jumlah_district
FROM country JOIN city
ON country.code=city.countrycode
WHERE continent='Asia'
GROUP BY country.continent
ORDER BY jumlah_district DESC;
3.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
Manakah fungsi di SQL untuk menampilkan jumlah karakter dari suatu data string?
LENGTH()
LEN()
CHAR()
LONG()
4.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
Pilihlah pernyataan yang kurang tepat.
Foreign key bisa muncul berulang dalam suatu tabel.
Primary key bisa muncul berulang dalam suatu tabel.
Foreign key adalah primary key yang terdapat di tabel lain.
Setiap tabel hanya bisa memiliki 1 kolom Primary key.
5.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
Perhatikan tabel country dan tabel city di gambar. Manakah kode yang tepat untuk menampilkan nama negara, GNP dan nama ibukota dari negara Jepang (Japan)?
SELECT city.name as Negara, country.name as Ibukota, country.GNP
FROM city LEFT JOIN country ON city.countrycode= country.code WHERE country.name='Japan';
SELECT city.name as Negara, country.name as Ibukota, country.GNP
FROM city JOIN country ON city.countrycode= country.code WHERE country.name='Japan';
SELECT city.name as Negara, country.name as Ibukota, country.GNP
FROM city JOIN country ON city.id= country.capital;
SELECT city.name as Negara, country.name as Ibukota, country.GNP
FROM city, country WHERE city.id = country.capital and country.name= 'Japan';
6.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
Manakah cara yang tepat untuk membuat dataframe berikut?
nama=['Andi','Budi','Caca']
umur=[24,25,28]
pd.DataFrame([nama,umur])
nama=['Andi','Budi','Caca']
umur=[24,25,28]
pd.DataFrame(list(zip(nama,umur)))
pd.DataFrame({
'Nama':'Andi Budi Caca'.split(),
'Umur':[24,25,28]
})
nama=['Andi','Budi','Caca']
umur=[24,25,28]
pd.DataFrame(list(zip(nama,umur))).T
7.
MULTIPLE CHOICE QUESTION
3 mins • 5 pts
Perhatikan dataframe berikut. Manakah cara yang paling tepat untuk melihat data apa saja yang dimiliki oleh kolom 'Departement' dan berapa frekuensi masing-masing data?
df['Departement'].nunique()
df['Departement'].value_counts()
df['Departement'].unique()
df.groupby('Departement').count()
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?