Create an SQL Query to show
how many customers there are in each state.
Sample results
ST CUST_COUNT
-- ----------
CA 1
GA 1
CO 2
DC 1
WA 4
BC 1
The Query is:
SELECT State AS ST, COUNT(CustomerID) AS CUST_COUNT
FROM CUSTOMER
GROUP BY State;
Create an SQL Query to show how many customers there are in each state. Sample results ST CUST_C...
Write one DDL statement to add ‘C_999’ as a new constraint in
Sales. This constraint ensures that no sale has a SalesPrice value
higher than AskingPrice value. This statement should only affect
new Artwork WorkID Title Copy Medium Description ArtistID Client
ClientID LastName FirstName Street City State ZipPostalCode Country
AreaCode PhoneNumber Email Sales DateAcquired AcquisitionPrice
AskingPrice DateSold SalesPrice ClientID WorkID rows inserted into
Sales in the future but not existing rows. If constraint ‘C_999’
needs to be deleted from Sales...
Suppose ‘ON UPDATE CASCADE’ is included in a foreign key
constraint of AWS. Explain its actual meaning and implication in
AWS.
Sales DateAcquired AcquisitionPrice AskingPrice DateSold SalesPrice Client ClientID Artwork LastName FirstName Street City State ZipPostalCode Country AreaCode PhoneNumber Email WorkID Title Copy Medium Description ArtistID ClientlD WorkID
The Chinook team would like to
throw a promotional Music Festival for their top 10 customers who
have spent the most in a single invoice. Write a query that returns
the first name, last name, and invoice total for the top 10
invoices ordered by invoice total descending.
MediaType Artist Album Track Artistld Albumld MediaTypeld Trackld Title Name Name Name Artistld Albumld MediaTypeld Genreld Composer Genre Playlist Track Playlist Milliseconds Genreld Playlistld Playlistld Name Bytes Name Trackld UnitPrice InvoiceLine Employee...
Write an SQL query against the Chinook Database v1.4. Each query
must run successfully using DB Browser for SQLite. Create the exact
query below. Must use sub query. I saw that a
similar solution for this question used IF and CONCAT functions
which do not work and return errors. If it is possible to use the
CASE function in place of IF that would be greatly appreciated.
Also I really hate to ask but if it could be organized neatly...
Using the database: Write SQL queries for each of the questions
below.
1. Find the media type which
has 100 or more tracks. Print the name of such media type. Number
of rows returned in the result = 3
A) Find the playlists which have one or more tracks that have
never been purchased in California (CA). Print the Id, and the name
of such playlists. Number of rows returned in the result = 18
B) Find the customers who...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query to display products purchased by
customers in Germany that were not purchased by customers in the
US.
Customers PK Customer D CompanyName Contact Name Contact Title Address City State OrRegion PostalCode Country Phone char(5) varchar(40) varchar(30) varchar(30) varchar(60) varchar(15) varchar(15) varchar(10) varchar(15) varchar(24) varchar(24) Order Details Orders PK OrderID int FK CustomerlD char(5) FK Employeeld int...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query because Northwind Traders wants to make
sure that all orders are shipped within 10 days. Display any orders
that were not shipped within 10 days. Include the OrderID, the
OrderDate, and the number of days it took before the order was
shipped.
Customers PK Customer D CompanyName Contact Name Contact Title Address City State OrRegion PostalCode...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query because Northwind Traders has decided to
increase their retail prices. Write a query that shows the product
name, the current price, and the new price. Make sure the new price
is listed to 2 decimal points. Follow below guidelines on new
retail price:
a. If the
category is beverages or dairy products, increase the price by...