1 / 3

SELECT * FROM CarType WHERE mark = 'Peugeot' SELECT cust_id,COUNT(*) AS count FROM Rent

SELECT * FROM CarType WHERE mark = 'Peugeot' SELECT cust_id,COUNT(*) AS count FROM Rent GROUP BY cust_id SELECT COUNT(*) AS 'over 45' FROM Car WHERE rate > 45 SELECT lastname FROM Customer WHERE lastname LIKE 'C%‘ ORDER BY lastname DESC INSERT INTO Customer

tangia
Download Presentation

SELECT * FROM CarType WHERE mark = 'Peugeot' SELECT cust_id,COUNT(*) AS count FROM Rent

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SELECT * FROM CarType WHERE mark = 'Peugeot' SELECT cust_id,COUNT(*) AS count FROM Rent GROUP BY cust_id SELECT COUNT(*) AS 'over 45' FROM Car WHERE rate > 45 SELECT lastname FROM Customer WHERE lastname LIKE 'C%‘ ORDER BY lastname DESC INSERT INTO Customer (lastname,firstname) VALUES ('Wayne','John') UPDATE Customer SET address = '2 Main St.' WHERE lastname = 'Wayne' AND firstname = 'John' UPDATE Customer SET postal_code = '23456’ WHERE lastname = 'Wayne' AND firstname = 'John' SELECT Rent.cust_id, lastname, firstname, reg_no FROM Rent,Customer WHERE Rent.cust_id < 4 AND Rent.cust_id = Customer.cust_id SELECT * FROM Car WHERE rate < (SELECT AVG(rate) FROM Car) Solutions (Repetition)

  2. INSERT INTO Rent (cust_id, reg_no, rent_date) VALUES (4 , 'BSA-224', '11.4.2005') SELECT reg_no, MIN(rent_date) AS Min, MAX(rent_date) AS Max FROM Rent GROUP BY reg_no SELECT Rent.reg_no, mark, model, rent_date FROM Rent, Car, CarType WHERE Rent.reg_no LIKE 'B%‘ AND return_date IS NULL AND Rent.reg_no=Car.reg_no AND Car.model_id=CarType.model_id SELECT * FROM Rent SELECT Car.reg_no, mark , model FROM Car, CarType WHERE Car.model_id = CarType.model_id AND rate BETWEEN 30 AND 50 INSERT INTO car (reg_no, model_id) VALUES ('EEE-666', 2) UPDATE car SET rate = 60 WHERE reg_no = 'EEE-666‘ SELECT COUNT(*) AS 'rents in 2005' FROM Rent WHERE YEAR(rent_date) = 2005 Solutions

  3. SELECT cust_id, COUNT(*) AS count FROM Rent GROUP BY cust_id SELECT lastname FROM Customer WHERE lastname LIKE 'A%s‘ SELECT cust_id FROM Rent GROUP BY cust_id HAVING COUNT(*) > 2 Solutions

More Related