SELECT business_1.name, business_1.Address,violations_1.Date,
violations_1.Code, violations_1.Description, inspections_1.score
FROM business_1, inspections_1, violations_1
WHERE business_1.Business_id = violations_1.Business_id
AND business_1.Business_id = inspections_1.business_id
AND inspections_1.date = violations_1.Date;
CREATE VIEW Restaurant_Inspection_Master AS
SELECT business_1.Name, business_1.Address,business_1.Phone_Number,violations_1.Date,
violations_1.Code, violations_1.Description, inspections_1.score
FROM business_1, inspections_1, violations_1
WHERE business_1.Business_id = violations_1.Business_id
AND business_1.Business_id = inspections_1.business_id
AND inspections_1.date = violations_1.Date;
SELECT *
FROM restaurant_inspection_master
WHERE restaurant_inspection_master.Name LIKE '%Tim%'
ORDER BY restaurant_inspection_master.Date desc;
SELECT *
FROM restaurant_inspection_master
WHERE restaurant_inspection_master.Name LIKE '%Hortons%'
ORDER BY restaurant_inspection_master.Date desc;
SELECT Year(date) Year, concat_ws(' ',Name,'-',Address) AS AddressName
FROM restaurant_inspection_master
WHERE concat_ws(' ',Name,',',Address) LIKE '%horton%'
GROUP BY Year, AddressName;
SELECT Year(date) Year, concat_ws(' ',Name,'-',Address) AS AddressName, Code
FROM restaurant_inspection_master
WHERE concat_ws(' ',Name,',',Address) LIKE '%horton%'
GROUP BY Year, AddressName;
SELECT Year(date) Year, concat_ws(' ',Name,'-',Address) AS AddressName, Code,
COUNT(*) as Inspections
FROM restaurant_inspection_master
WHERE concat_ws(' ',Name,',',Address) LIKE '%horton%'
GROUP BY Year, AddressName;
SELECT YEAR(Date) AS Year, COUNT(*) AS Inspections
FROM restaurant_inspection_master
WHERE restaurant_inspection_master.Name LIKE '%Tim%'
GROUP BY year
ORDER BY Inspections desc;