SQLQuery

sql

School

Arizona State University *

*We aren’t endorsed by this school

Course

6312

Subject

Computer Science

Date

Oct 30, 2023

Type

sql

Pages

2

Uploaded by PrivateDugongMaster226

Report
--1. What is the payment type most commonly used, group by payment type.-- SELECT DISTINCT Payment_Type FROM [dbo].[PaymentMode] GROUP BY Payment_Type; --2. At what time of the day the prices are high-- SELECT from_hours, to_hours, Price.ID, Price.Price FROM [dbo].[OperatingHours] Operatinghrs INNER JOIN [dbo].[Locations] Locations ON Operatinghrs.placeID = Locations.placeID INNER JOIN [dbo].[PriceLookup] Price ON Price.ID = Locations.Price WHERE Price.Price = 'high'; --3. which places servers Alcohol and also has smoking area-- SELECT Locations.name, alcohol.Alcohol, smoke.Smoking_Area FROM [dbo].[AlcoholLookup] alcohol INNER JOIN [dbo].[Locations] Locations ON alcohol.Id = Locations.alcohol INNER JOIN [dbo].[SmokingAreaLookup] smoke ON Locations.smoking_area = smoke.Id WHERE smoke.Smoking_Area ='permitted' AND alcohol.Alcohol IN ('Full_Bar','Wine- Beer'); --4. Display names of the places which have valet parking-- SELECT locations.name as "NAME", Locations.address "ADDRESS" , locations.placeID "PLACE_ID" FROM [dbo].[Locations] locations INNER JOIN [dbo].[ParkingMode] parking ON locations.placeID = parking.placeID WHERE parking.parking_lot = 'valet parking'; --5. Count NO of places where SmokingArea is permitted inn either ways. SELECT COUNT(smoke.Smoking_Area) As placesHaving_SmokeArea FROM [dbo].[SmokingAreaLookup] smoke INNER JOIN [dbo].[Locations] locations ON smoke.Id= locations.smoking_area WHERE smoke.Smoking_Area IN ('permitted','only at bar','section'); /*6. Update the address as "850 Cecil drive", city as "Richardson", state as "TX", country as "United States" and zip as "75080" where name is equal to "Cafe Chaires"*/ UPDATE [dbo].[locations] SET address = '850 Cecil drive', city='Richardson',state='TX',country='United States',zip='75080' WHERE name ='cafe ambar'; --Check if columns are updates or not--
SELECT name,address, city, state, country, zip from [dbo].[locations] WHERE name ='cafe ambar'; SELECT * FROM [dbo].[Cuisine]; --7. Display the type of cuisine and no of particular cuisine types in decreasing order of total number of cuisines-- SELECT DISTINCT Cuisine_Type, count(Cuisine_Type) as total_number_of_cuisine FROM [dbo].[Cuisine] Group by Cuisine_Type ORDER BY total_number_of_cuisine DESC; --8. Display the name of the cusines where Area_Code is open-- SELECT DISTINCT locations.name FROM [dbo].[locations] locations INNER JOIN [dbo].[AreaLookup] area ON locations.area = area.ID WHERE area.Area_Code ='open' ORDER BY locations.name; /*9. Display the names and ratings of the restaurant whose rating, food and service rating is 2, i.e. most people would prefer this restaurant */ SELECT DISTINCT locations.name, ratings.rating, ratings.food_rating, ratings.service_rating FROM [dbo].[locations] locations INNER JOIN [dbo].[Rating] ratings ON locations.placeID =ratings.placeID WHERE ratings.food_rating = 2 AND ratings.service_rating=2 AND ratings.rating =2; /*10. Display the no of locations and the zip code for that location where the address and zip code is not null and also having no of cuisines more than or equal to 3. */ SELECT count(locations.name) AS no_of_cuisines, Locations.zip FROM [dbo].[Locations] locations INNER JOIN [dbo].[PriceLookup] price ON locations.price = price.ID WHERE locations.address != 'null' AND locations.zip != 'null' GROUP BY locations.zip HAVING count(locations.name)>=3 ORDER BY locations.zip,no_of_cuisines desc;
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: Corporation has sold 1,000 units of product in a month and provided the following contribution…
Q: A 3.2-kg piece of putty is dropped 2.3 m onto the initially stationary block, which is supported by…
Q: Measurements show that the energy of a mixture of gaseous reactants decreases by 285. kJ during a…
Q: Use cylindrical coordinates to calculate : JS₁ ² + y² dv W: x² + y² ≤ 36, 0≤z ≤2
Q: me Calculate the value of the Sample Varance Round 1 elecimal place -13₁-13, @21 2₁ -13, 2-9 XX comp
Q: In problem 18, use the respective polynomial to answer the following: (a) test for with synthetic…
Q: What mass of carbon dioxide is produced from the complete combustion of 2.20x10-3 g of methane?…
Q: t of standard residuals on the predicted values. Are all four regression assumptions satisfied?
Q: Find the curve's unit tangent vector. Also, find the length of the indicated portion of the curve. 3…
Q: Solve the initial value problem for r as a vector function of t. d?r Differential equation: ? -22k…
Q: A H1 NMR signal is observed at 117.0 Hz (downfield of TMS) on a 1.20×102‑MHz instrument. a) What is…
Q: PROGRAM 6: Three Zero Game Write a program that reads a number. Then by subtracting off a three and…
Q: How many distinct proper subsets are there of the set N = {9, 41, 68, 17, 33, 54}?
Q: Danielle has been watching Carn Pass for the last hour and has been Counting how many cars of each…
Q: In Exercises 9-16 of Section 13.4, you found T, N, and K. Now, in the following Exercises 9-16, find…
Q: A company can charge a price of 76 dollars per unit when they sell 420 units. If the price increases…
Q: A transaction has been recorded in the general journal of Todd Company as follows: Account Title…
Q: If f(x) = f'(x) = f'(1) = 6x + 2 7x + 2 find: 2 (7x + 2)² 28 (7x+2)³ X
Q: The electric flux through the surface shown in the figure (Figure 1)is 30 Nm²/C. You may want to…
Q: Recall that the risk-neutral probability of an asset corresponds to the probability for which the…
Q: Write a function that takes two call-by-reference arguments that are pointer variables that point to…
Q: Which input must be active for a BCD priority encoder for its active-HIGH outputs to have the…