answer
stringlengths
18
557
question
stringlengths
12
280
context
stringlengths
27
489
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1
Apa kode jenis kartu dengan sebagian besar jumlah kartu?
CREATE TABLE Customers_cards (card_type_code VARCHAR)
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5
Tampilkan kode jenis kartu dengan setidaknya 5 kartu.
CREATE TABLE Customers_cards (card_type_code VARCHAR)
SELECT card_type_code, COUNT(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code
Tunjukkan semua kode jenis kartu dan jumlah pelanggan yang memegang kartu di setiap jenis.
CREATE TABLE Customers_cards (card_type_code VARCHAR, customer_id VARCHAR)
SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = "Credit"
Tunjukkan ID pelanggan dan nama depan tanpa kartu kredit.
CREATE TABLE Customers_cards (customer_id VARCHAR); CREATE TABLE Customers (customer_first_name VARCHAR, customer_id VARCHAR); CREATE TABLE Customers (customer_id VARCHAR, customer_first_name VARCHAR, card_type_code VARCHAR)
SELECT DISTINCT card_type_code FROM Customers_Cards
Tampilkan semua kode jenis kartu.
CREATE TABLE Customers_Cards (card_type_code VARCHAR)
SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards
Tunjukkan jumlah jenis kartu.
CREATE TABLE Customers_Cards (card_type_code VARCHAR)
SELECT DISTINCT transaction_type FROM Financial_Transactions
Tunjukkan semua jenis transaksi.
CREATE TABLE Financial_Transactions (transaction_type VARCHAR)
SELECT COUNT(DISTINCT transaction_type) FROM Financial_Transactions
Tunjukkan jumlah jenis transaksi.
CREATE TABLE Financial_Transactions (transaction_type VARCHAR)
SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions
Berapa jumlah rata -rata dan total transaksi?
CREATE TABLE Financial_transactions (transaction_amount INTEGER)
SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code
Tunjukkan kode jenis kartu dan jumlah transaksi.
CREATE TABLE Financial_transactions (card_id VARCHAR); CREATE TABLE Customers_cards (card_type_code VARCHAR, card_id VARCHAR)
SELECT transaction_type, COUNT(*) FROM Financial_transactions GROUP BY transaction_type
Tunjukkan jenis transaksi dan jumlah transaksi.
CREATE TABLE Financial_transactions (transaction_type VARCHAR)
SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1
Berapa jenis transaksi yang telah memproses jumlah total terbesar dalam transaksi?
CREATE TABLE Financial_transactions (transaction_type VARCHAR, transaction_amount INTEGER)
SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id
Tunjukkan ID akun dan jumlah transaksi untuk setiap akun
CREATE TABLE Financial_transactions (account_id VARCHAR)
SELECT COUNT(*) FROM track
Berapa banyak trek yang kita miliki?
CREATE TABLE track (Id VARCHAR)
SELECT name, LOCATION FROM track
Tunjukkan nama dan lokasi untuk semua trek.
CREATE TABLE track (name VARCHAR, LOCATION VARCHAR)
SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating
Tunjukkan nama dan tempat duduk, dipesan dengan tempat duduk untuk semua trek yang dibuka setelah tahun 2000.
CREATE TABLE track (name VARCHAR, seating VARCHAR, year_opened INTEGER)
SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1
Apa nama, lokasi, dan tempat duduk untuk trek yang paling baru dibuka?
CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, seating VARCHAR, year_opened VARCHAR)
SELECT MIN(seating), MAX(seating), AVG(seating) FROM track
Berapakah tempat duduk minimum, maksimum, dan rata -rata untuk semua trek.
CREATE TABLE track (seating INTEGER)
SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)
Tunjukkan nama, lokasi, tahun buka untuk semua trek dengan tempat duduk yang lebih tinggi dari rata -rata.
CREATE TABLE track (name VARCHAR, LOCATION VARCHAR, year_opened VARCHAR, seating INTEGER)
SELECT DISTINCT LOCATION FROM track
Lokasi mana yang berbeda di mana trek berada?
CREATE TABLE track (LOCATION VARCHAR)
SELECT COUNT(*) FROM race
Ada berapa ras?
CREATE TABLE race (Id VARCHAR)
SELECT DISTINCT CLASS FROM race
Apa kelas berbeda yang bisa dimiliki ras?
CREATE TABLE race (CLASS VARCHAR)
SELECT name, CLASS, date FROM race
Tampilkan nama, kelas, dan tanggal untuk semua balapan.
CREATE TABLE race (name VARCHAR, CLASS VARCHAR, date VARCHAR)
SELECT CLASS, COUNT(*) FROM race GROUP BY CLASS
Tunjukkan kelas balap dan jumlah balapan di setiap kelas.
CREATE TABLE race (CLASS VARCHAR)
SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1
Apa kelas balap dengan sebagian besar jumlah balapan.
CREATE TABLE race (CLASS VARCHAR)
SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2
Sebutkan kelas balap dengan setidaknya dua balapan.
CREATE TABLE race (CLASS VARCHAR)
SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'
Apa nama trek tanpa balapan di kelas 'GT'.
CREATE TABLE race (track_id VARCHAR, class VARCHAR); CREATE TABLE track (name VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR)
SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)
Tunjukkan semua nama trek yang tidak memiliki balapan.
CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (name VARCHAR, track_id VARCHAR)
SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
Tunjukkan tahun di mana trek dengan tempat duduk setidaknya 5000 dibuka dan trek dengan tempat duduk tidak lebih dari 4000 dibuka.
CREATE TABLE track (year_opened VARCHAR, seating INTEGER)
SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
Tunjukkan nama trek dan jumlah balapan di setiap trek.
CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (track_id VARCHAR)
SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1
Tunjukkan nama trek dengan sebagian besar balapan.
CREATE TABLE track (name VARCHAR, track_id VARCHAR); CREATE TABLE race (track_id VARCHAR)
SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
Tunjukkan nama dan tanggal untuk setiap balapan dan nama treknya.
CREATE TABLE race (name VARCHAR, date VARCHAR, track_id VARCHAR); CREATE TABLE track (name VARCHAR, track_id VARCHAR)
SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1
Tunjukkan nama dan lokasi trek dengan 1 balapan.
CREATE TABLE race (track_id VARCHAR); CREATE TABLE track (name VARCHAR, location VARCHAR, track_id VARCHAR)
SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000
Temukan lokasi di mana memiliki kedua trek dengan lebih dari 90000 kursi dan trek dengan kurang dari 70000 kursi.
CREATE TABLE track (LOCATION VARCHAR, seating INTEGER)
SELECT COUNT(*) FROM member WHERE Membership_card = 'Black'
Berapa banyak anggota yang memiliki kartu keanggotaan hitam?
CREATE TABLE member (Membership_card VARCHAR)
SELECT COUNT(*), address FROM member GROUP BY address
Temukan jumlah anggota yang tinggal di setiap alamat.
CREATE TABLE member (address VARCHAR)
SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'
Beri saya nama -nama anggota yang alamatnya ada di Harford atau Waterbury.
CREATE TABLE member (name VARCHAR, address VARCHAR)
SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30
Temukan ID dan nama anggota yang berusia di bawah 30 tahun atau dengan kartu keanggotaan hitam.
CREATE TABLE member (name VARCHAR, member_id VARCHAR, Membership_card VARCHAR, age VARCHAR)
SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase
Temukan waktu pembelian, usia, dan alamat masing -masing anggota, dan tunjukkan hasilnya dalam urutan waktu pembelian.
CREATE TABLE member (Time_of_purchase VARCHAR, age VARCHAR, address VARCHAR)
SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5
Kartu keanggotaan mana yang memiliki lebih dari 5 anggota?
CREATE TABLE member (Membership_card VARCHAR)
SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40
Alamat mana yang memiliki keduanya lebih muda dari 30 dan anggota lebih dari 40?
CREATE TABLE member (address VARCHAR, age INTEGER)
SELECT membership_card FROM member WHERE address = 'Hartford' INTERSECT SELECT membership_card FROM member WHERE address = 'Waterbury'
Apa kartu keanggotaan yang dipegang oleh kedua anggota yang tinggal di Hartford dan yang tinggal di alamat Waterbury?
CREATE TABLE member (membership_card VARCHAR, address VARCHAR)
SELECT COUNT(*) FROM member WHERE address <> 'Hartford'
Berapa banyak anggota yang tidak tinggal di Hartford?
CREATE TABLE member (address VARCHAR)
SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'
Alamat mana yang tidak memiliki anggota dengan kartu keanggotaan kulit hitam?
CREATE TABLE member (address VARCHAR, Membership_card VARCHAR)
SELECT address FROM shop ORDER BY open_year
Tunjukkan alamat toko yang dipesan pada tahun pembukaan mereka.
CREATE TABLE shop (address VARCHAR, open_year VARCHAR)
SELECT AVG(num_of_staff), AVG(score) FROM shop
Berapa skor rata -rata dan jumlah staf rata -rata semua toko?
CREATE TABLE shop (num_of_staff INTEGER, score INTEGER)
SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop)
Temukan ID dan alamat toko -toko yang nilainya di bawah skor rata -rata.
CREATE TABLE shop (shop_id VARCHAR, address VARCHAR, score INTEGER)
SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour)
Temukan alamat dan staf toko yang tidak memiliki happy hour.
CREATE TABLE shop (address VARCHAR, num_of_staff VARCHAR, shop_id VARCHAR); CREATE TABLE happy_hour (address VARCHAR, num_of_staff VARCHAR, shop_id VARCHAR)
SELECT t1.address, t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = 'May'
Apa ID dan alamat toko yang memiliki happy hour di bulan Mei?
CREATE TABLE shop (address VARCHAR, shop_id VARCHAR); CREATE TABLE happy_hour (shop_id VARCHAR)
SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1
Toko mana yang paling sering memiliki happy hour?Sebutkan ID dan jumlah jam happy.
CREATE TABLE happy_hour (shop_id VARCHAR)
SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1
Bulan mana yang paling bahagia?
CREATE TABLE happy_hour (MONTH VARCHAR)
SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2
Bulan mana yang memiliki lebih dari 2 jam bahagia?
CREATE TABLE happy_hour (MONTH VARCHAR)
SELECT COUNT(*) FROM ALBUM
Ada berapa album?
CREATE TABLE ALBUM (Id VARCHAR)
SELECT Name FROM GENRE
Sebutkan nama semua genre musik.
CREATE TABLE GENRE (Name VARCHAR)
SELECT * FROM CUSTOMER WHERE State = "NY"
Temukan semua informasi pelanggan di negara bagian NY.
CREATE TABLE CUSTOMER (State VARCHAR)
SELECT FirstName, LastName FROM EMPLOYEE WHERE City = "Calgary"
Siapa nama depan dan nama belakang karyawan yang tinggal di Calgary City.
CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, City VARCHAR)
SELECT DISTINCT (BillingCountry) FROM INVOICE
Apa negara penagihan yang berbeda dari faktur?
CREATE TABLE INVOICE (BillingCountry VARCHAR)
SELECT Name FROM ARTIST WHERE Name LIKE "%a%"
Temukan nama semua artis yang memiliki "A" atas nama mereka.
CREATE TABLE ARTIST (Name VARCHAR)
SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "AC/DC"
Temukan judul semua album artis "AC/DC".
CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)
SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "Metallica"
Berapa banyak album yang dimiliki artis "Metallica"?
CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)
SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "Balls to the Wall"
Artis mana album "Balls to the Wall"?
CREATE TABLE ALBUM (ArtistId VARCHAR, Title VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)
SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1
Artis mana yang memiliki album terbanyak?
CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)
SELECT Name FROM TRACK WHERE Name LIKE '%you%'
Temukan nama semua trek yang berisi kata "Anda".
CREATE TABLE TRACK (Name VARCHAR)
SELECT AVG(UnitPrice) FROM TRACK
Berapa harga unit rata -rata semua trek?
CREATE TABLE TRACK (UnitPrice INTEGER)
SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK
Apa durasi trek terpanjang dan terpendek dalam milidetik?
CREATE TABLE TRACK (Milliseconds INTEGER)
SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID
Tampilkan nama album, ID, dan jumlah lagu untuk setiap album.
CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR)
SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1
Apa nama genre yang paling umum di semua trek?
CREATE TABLE GENRE (Name VARCHAR, GenreId VARCHAR); CREATE TABLE TRACK (GenreId VARCHAR)
SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) LIMIT 1
Apa jenis media yang paling tidak umum di semua trek?
CREATE TABLE MEDIATYPE (Name VARCHAR, MediaTypeId VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR)
SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID
Tampilkan nama album dan ID untuk album yang berisi trek dengan harga satuan lebih besar dari 1.
CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR); CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR, UnitPrice INTEGER)
SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock"
Berapa banyak trek milik genre rock?
CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Jazz"
Berapa harga unit rata -rata trek yang menjadi milik genre jazz?
CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br"
Siapa nama depan dan nama belakang pelanggan yang memiliki email "luisg@embraer.com.br"?
CREATE TABLE CUSTOMER (FirstName VARCHAR, LastName VARCHAR, Email VARCHAR)
SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%"
Berapa banyak pelanggan yang memiliki email yang berisi "gmail.com"?
CREATE TABLE CUSTOMER (Email VARCHAR)
SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "Leonie"
Apa nama depan dan nama belakang karyawan membantu pelanggan dengan nama depan Leonie?
CREATE TABLE CUSTOMER (SupportRepId VARCHAR, FirstName VARCHAR); CREATE TABLE EMPLOYEE (FirstName VARCHAR, LastName VARCHAR, EmployeeId VARCHAR)
SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174"
Di kota mana karyawan yang membantu pelanggan dengan kode pos 70174 tinggal?
CREATE TABLE EMPLOYEE (City VARCHAR, EmployeeId VARCHAR); CREATE TABLE CUSTOMER (SupportRepId VARCHAR, PostalCode VARCHAR)
SELECT COUNT(DISTINCT city) FROM EMPLOYEE
Berapa banyak kota berbeda yang ditinggali karyawan?
CREATE TABLE EMPLOYEE (city VARCHAR)
SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber"
Temukan semua tanggal faktur yang sesuai dengan pelanggan dengan nama depan Astrid dan nama belakang Gruber.
CREATE TABLE CUSTOMER (CustomerId VARCHAR, FirstName VARCHAR); CREATE TABLE INVOICE (InvoiceDate VARCHAR, CustomerId VARCHAR)
SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20
Temukan semua nama belakang pelanggan yang tidak memiliki total faktur lebih besar dari 20.
CREATE TABLE CUSTOMER (LastName VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, CustomerId VARCHAR); CREATE TABLE Invoice (CustomerId VARCHAR, total INTEGER)
SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Brazil"
Temukan nama pertama semua pelanggan yang tinggal di Brasil dan memiliki faktur.
CREATE TABLE CUSTOMER (FirstName VARCHAR, CustomerId VARCHAR, country VARCHAR); CREATE TABLE INVOICE (CustomerId VARCHAR)
SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "Germany"
Temukan alamat semua pelanggan yang tinggal di Jerman dan memiliki faktur.
CREATE TABLE INVOICE (CustomerId VARCHAR); CREATE TABLE CUSTOMER (Address VARCHAR, CustomerId VARCHAR, country VARCHAR)
SELECT Phone FROM EMPLOYEE
Sebutkan nomor telepon semua karyawan.
CREATE TABLE EMPLOYEE (Phone VARCHAR)
SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC audio file"
Berapa banyak trek dalam tipe media file audio AAC?
CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (MediaTypeId VARCHAR)
SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop"
Berapa durasi rata -rata dalam milidetik trek yang dimiliki oleh genre Latin atau pop?
CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10
Silakan tunjukkan nama depan karyawan dan ID karyawan yang melayani setidaknya 10 pelanggan.
CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR); CREATE TABLE EMPLOYEE (EmployeeId VARCHAR)
SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20
Tolong tunjukkan nama belakang karyawan yang melayani tidak lebih dari 20 pelanggan.
CREATE TABLE EMPLOYEE (EmployeeId VARCHAR); CREATE TABLE CUSTOMER (LastName VARCHAR, SupportRepId VARCHAR)
SELECT Title FROM ALBUM ORDER BY Title
Harap daftarkan semua judul album dalam urutan abjad.
CREATE TABLE ALBUM (Title VARCHAR)
SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name
Harap daftarkan nama dan ID dari semua artis yang memiliki setidaknya 3 album dalam urutan abjad.
CREATE TABLE ARTIST (Name VARCHAR, ArtistID VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR)
SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId
Temukan nama artis yang tidak memiliki album.
CREATE TABLE ARTIST (Name VARCHAR); CREATE TABLE ALBUM (ArtistId VARCHAR); CREATE TABLE ARTIST (Name VARCHAR, ArtistId VARCHAR)
SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock"
Berapa harga unit rata -rata trek batu?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR); CREATE TABLE TRACK (UnitPrice INTEGER, GenreId VARCHAR)
SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Pop"
Berapa durasi trek pop terpanjang dan terpendek dalam milidetik?
CREATE TABLE TRACK (GenreId VARCHAR); CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR)
SELECT BirthDate FROM EMPLOYEE WHERE City = "Edmonton"
Apa tanggal lahir karyawan yang tinggal di Edmonton?
CREATE TABLE EMPLOYEE (BirthDate VARCHAR, City VARCHAR)
SELECT DISTINCT (UnitPrice) FROM TRACK
Apa harga unit yang berbeda dari semua trek?
CREATE TABLE TRACK (UnitPrice VARCHAR)
SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)
Berapa banyak artis yang tidak memiliki album?
CREATE TABLE ARTIST (artistid VARCHAR); CREATE TABLE ALBUM (artistid VARCHAR)
SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock'
Apa judul album untuk album yang berisi lagu genre 'reggae' dan 'rock'?
CREATE TABLE Genre (GenreID VARCHAR, Name VARCHAR); CREATE TABLE Track (AlbumId VARCHAR, GenreID VARCHAR); CREATE TABLE Album (Title VARCHAR, AlbumId VARCHAR)
SELECT customer_phone FROM available_policies
Temukan semua nomor telepon.
CREATE TABLE available_policies (customer_phone VARCHAR)
SELECT customer_phone FROM available_policies WHERE policy_type_code = "Life Insurance"
Berapa nomor telepon pelanggan di bawah polis "asuransi jiwa"?
CREATE TABLE available_policies (customer_phone VARCHAR, policy_type_code VARCHAR)
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
Jenis kebijakan mana yang memiliki catatan terbanyak dalam database?
CREATE TABLE available_policies (policy_type_code VARCHAR)
SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)
Apa saja nomor telepon pelanggan di bawah jenis kebijakan paling populer?
CREATE TABLE available_policies (customer_phone VARCHAR, policy_type_code VARCHAR)
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4
Temukan jenis kebijakan yang digunakan oleh lebih dari 4 pelanggan.
CREATE TABLE available_policies (policy_type_code VARCHAR)
SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements
Temukan jumlah total dan rata -rata pemukiman.
CREATE TABLE settlements (settlement_amount INTEGER)