question
stringlengths 16
224
| schema
stringlengths 142
5.86k
| query
stringlengths 20
577
|
---|---|---|
List title of albums have the number of tracks greater than 10. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING count(T1.id) > 10; |
What are the names of the albums that have more than 10 tracks? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING count(T1.id) > 10; |
List the name of tracks belongs to genre Rock and whose media type is MPEG audio file. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" AND T3.name = "MPEG audio file"; |
What are the names of all Rock tracks that are stored on MPEG audio files? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" AND T3.name = "MPEG audio file"; |
List the name of tracks belongs to genre Rock or media type is MPEG audio file. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" OR T3.name = "MPEG audio file"; |
What are the names of all tracks that belong to the Rock genre and whose media type is MPEG? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" OR T3.name = "MPEG audio file"; |
List the name of tracks belongs to genre Rock or genre Jazz. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = "Rock" OR T1.name = "Jazz" |
What are the names of the tracks that are Rock or Jazz songs? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = "Rock" OR T1.name = "Jazz" |
List the name of all tracks in the playlists of Movies. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = "Movies"; |
What are the names of all tracks that are on playlists titled Movies? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = "Movies"; |
List the name of playlist which has number of tracks greater than 100. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING count(T1.track_id) > 100; |
What are the names of all playlists that have more than 100 tracks? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING count(T1.track_id) > 100; |
List all tracks bought by customer Daan Peeters. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = "Daan" AND T4.last_name = "Peeters"; |
What are the tracks that Dean Peeters bought? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = "Daan" AND T4.last_name = "Peeters"; |
How much is the track Fast As a Shark? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT unit_price FROM tracks WHERE name = "Fast As a Shark"; |
What is the unit price of the tune "Fast As a Shark"? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT unit_price FROM tracks WHERE name = "Fast As a Shark"; |
Find the name of tracks which are in Movies playlist but not in music playlist. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music' |
What are the names of all tracks that are on the Movies playlist but not in the music playlist? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music' |
Find the name of tracks which are in both Movies and music playlists. | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music' |
What are the names of all the tracks that are in both the Movies and music playlists? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music' |
Find number of tracks in each genre? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT count(*) , T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name; |
How many tracks are in each genre? | artists: id (INTEGER), name (VARCHAR(120))
albums: id (INTEGER), title (VARCHAR(160)), artist_id (INTEGER)
employees: id (INTEGER), last_name (VARCHAR(20)), first_name (VARCHAR(20)), title (VARCHAR(30)), reports_to (INTEGER), birth_date (TIMESTAMP), hire_date (TIMESTAMP), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60))
customers: id (INTEGER), first_name (VARCHAR(40)), last_name (VARCHAR(20)), company (VARCHAR(80)), address (VARCHAR(70)), city (VARCHAR(40)), state (VARCHAR(40)), country (VARCHAR(40)), postal_code (VARCHAR(10)), phone (VARCHAR(24)), fax (VARCHAR(24)), email (VARCHAR(60)), support_rep_id (INTEGER)
genres: id (INTEGER), name (VARCHAR(120))
invoices: id (INTEGER), customer_id (INTEGER), invoice_date (TIMESTAMP), billing_address (VARCHAR(70)), billing_city (VARCHAR(40)), billing_state (VARCHAR(40)), billing_country (VARCHAR(40)), billing_postal_code (VARCHAR(10)), total (NUMERIC(102))
media_types: id (INTEGER), name (VARCHAR(120))
tracks: id (INTEGER), name (VARCHAR(200)), album_id (INTEGER), media_type_id (INTEGER), genre_id (INTEGER), composer (VARCHAR(220)), milliseconds (INTEGER), bytes (INTEGER), unit_price (NUMERIC(102))
invoice_lines: id (INTEGER), invoice_id (INTEGER), track_id (INTEGER), unit_price (NUMERIC(102)), quantity (INTEGER)
playlists: id (INTEGER), name (VARCHAR(120))
playlist_tracks: playlist_id (INTEGER), track_id (INTEGER) | SELECT count(*) , T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name; |
How many editors are there? | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT count(*) FROM editor |
List the names of editors in ascending order of age. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Name FROM editor ORDER BY Age ASC |
What are the names and ages of editors? | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Name , Age FROM editor |
List the names of editors who are older than 25. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Name FROM editor WHERE Age > 25 |
Show the names of editors of age either 24 or 25. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Name FROM editor WHERE Age = 24 OR Age = 25 |
What is the name of the youngest editor? | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Name FROM editor ORDER BY Age ASC LIMIT 1 |
What are the different ages of editors? Show each age along with the number of editors of that age. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Age , COUNT(*) FROM editor GROUP BY Age |
Please show the most common age of editors. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1 |
Show the distinct themes of journals. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT DISTINCT Theme FROM journal |
Show the names of editors and the theme of journals for which they serve on committees. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT T2.Name , T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID |
For each journal_committee, find the editor name and the journal theme. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT T2.Name , T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID |
Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT T2.Name , T2.age , T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme ASC |
Show the names of editors that are on the committee of journals with sales bigger than 3000. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000 |
Show the id, name of each editor and the number of journal committees they are on. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT T1.editor_id , T1.Name , COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id |
Show the names of editors that are on at least two journal committees. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*) >= 2 |
List the names of editors that are not on any journal committee. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT Name FROM editor WHERE editor_id NOT IN (SELECT editor_id FROM journal_committee) |
List the date, theme and sales of the journal which did not have any of the listed editors serving on committee. | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT date , theme , sales FROM journal EXCEPT SELECT T1.date , T1.theme , T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID |
What is the average sales of the journals that have an editor whose work type is 'Photo'? | journal: Journal_ID (INT), Date (TEXT), Theme (TEXT), Sales (INT)
editor: Editor_ID (INT), Name (TEXT), Age (REAL)
journal_committee: Editor_ID (INT), Journal_ID (INT), Work_Type (TEXT) | SELECT avg(T1.sales) FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID WHERE T2.work_type = 'Photo' |
How many accounts do we have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Accounts |
Count the number of accounts. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Accounts |
Show ids, customer ids, names for all accounts. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT account_id , customer_id , account_name FROM Accounts |
What are the account ids, customer ids, and account names for all the accounts? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT account_id , customer_id , account_name FROM Accounts |
Show other account details for account with name 338. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT other_account_details FROM Accounts WHERE account_name = "338" |
What are the other account details for the account with the name 338? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT other_account_details FROM Accounts WHERE account_name = "338" |
What is the first name, last name, and phone of the customer with account name 162? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "162" |
Give the full name and phone of the customer who has the account name 162. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "162" |
How many accounts does the customer with first name Art and last name Turcotte have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte" |
Return the number of accounts that the customer with the first name Art and last name Turcotte has. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte" |
Show all customer ids and the number of accounts for each customer. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Accounts GROUP BY customer_id |
How many accounts are there for each customer id? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Accounts GROUP BY customer_id |
Show the customer id and number of accounts with most accounts. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Accounts GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1 |
What is the customer id of the customer with the most accounts, and how many accounts does this person have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Accounts GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1 |
What is the customer first, last name and id with least number of accounts. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T2.customer_first_name , T2.customer_last_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1 |
Give the full name and customer id of the customer with the fewest accounts. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T2.customer_first_name , T2.customer_last_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1 |
Show the number of all customers without an account. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts) |
How many customers do not have an account? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts) |
Show the first names and last names of customers without any account. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_first_name , customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id |
What are the full names of customers who do not have any accounts? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_first_name , customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id |
Show distinct first and last names for all customers with an account. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT DISTINCT T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id |
What are the full names of customers who have accounts? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT DISTINCT T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id |
How many customers have an account? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(DISTINCT customer_id) FROM Accounts |
Count the number of customers who hold an account. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(DISTINCT customer_id) FROM Accounts |
How many customers do we have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers |
Count the number of customers. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers |
Show ids, first names, last names, and phones for all customers. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , customer_first_name , customer_last_name , customer_phone FROM Customers |
What are the ids, full names, and phones of each customer? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , customer_first_name , customer_last_name , customer_phone FROM Customers |
What is the phone and email for customer with first name Aniyah and last name Feest? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_phone , customer_email FROM Customers WHERE customer_first_name = "Aniyah" AND customer_last_name = "Feest" |
Return the phone and email of the customer with the first name Aniyah and last name Feest. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_phone , customer_email FROM Customers WHERE customer_first_name = "Aniyah" AND customer_last_name = "Feest" |
Show the number of customer cards. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards |
How many customer cards are there? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards |
Show ids, customer ids, card type codes, card numbers for all cards. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_id , customer_id , card_type_code , card_number FROM Customers_cards |
What are card ids, customer ids, card types, and card numbers for each customer card? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_id , customer_id , card_type_code , card_number FROM Customers_cards |
Show the date valid from and the date valid to for the card with card number '4560596484842'. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842" |
What are the valid from and valid to dates for the card with the number 4560596484842? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT date_valid_from , date_valid_to FROM Customers_cards WHERE card_number = "4560596484842" |
What is the first name, last name, and phone of the customer with card 4560596484842. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = "4560596484842" |
Return the full name and phone of the customer who has card number 4560596484842. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T2.customer_first_name , T2.customer_last_name , T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = "4560596484842" |
How many cards does customer Art Turcotte have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte" |
Count the number of cards the customer with the first name Art and last name Turcotte has. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte" |
How many debit cards do we have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit" |
Count the number of customer cards of the type Debit. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards WHERE card_type_code = "Debit" |
How many credit cards does customer Blanche Huels have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit" |
Count the number of credit cards that the customer with first name Blanche and last name Huels has. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit" |
Show all customer ids and the number of cards owned by each customer. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id |
What are the different customer ids, and how many cards does each one hold? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id |
What is the customer id with most number of cards, and how many does he have? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1 |
Return the id of the customer who has the most cards, as well as the number of cards. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1 |
Show id, first and last names for all customers with at least two cards. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2 |
What are the ids and full names of customers who hold two or more cards? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2 |
What is the customer id, first and last name with least number of accounts. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1 |
Return the id and full name of the customer who has the fewest accounts. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1 |
Show all card type codes and the number of cards in each type. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code |
What are the different card types, and how many cards are there of each? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code , count(*) FROM Customers_cards GROUP BY card_type_code |
What is the card type code with most number of cards? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1 |
Return the code of the card type that is most common. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1 |
Show card type codes with at least 5 cards. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5 |
What are the codes of card types that have 5 or more cards? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING count(*) >= 5 |
Show all card type codes and the number of customers holding cards in each type. | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code |
What are the different card type codes, and how many different customers hold each type? | Accounts: account_id (INTEGER), customer_id (INTEGER), account_name (VARCHAR(50)), other_account_details (VARCHAR(255))
Customers: customer_id (INTEGER), customer_first_name (VARCHAR(20)), customer_last_name (VARCHAR(20)), customer_address (VARCHAR(255)), customer_phone (VARCHAR(255)), customer_email (VARCHAR(255)), other_customer_details (VARCHAR(255))
Customers_Cards: card_id (INTEGER), customer_id (INTEGER), card_type_code (VARCHAR(15)), card_number (VARCHAR(80)), date_valid_from (DATETIME), date_valid_to (DATETIME), other_card_details (VARCHAR(255))
Financial_Transactions: transaction_id (INTEGER), previous_transaction_id (INTEGER), account_id (INTEGER), card_id (INTEGER), transaction_type (VARCHAR(15)), transaction_date (DATETIME), transaction_amount (DOUBLE), transaction_comment (VARCHAR(255)), other_transaction_details (VARCHAR(255)) | SELECT card_type_code , count(DISTINCT customer_id) FROM Customers_cards GROUP BY card_type_code |
Subsets and Splits