Tano
Tano

Reputation: 619

SQL Ride Sharing company

I have designed a database for a ride sharing company, I wrote some queries that can be used with it, but I cant make work one query - where I want to know how much money does the driver made for a month, I will provide the ER diagram, if it is not understandable I will also upload the queries that I have created the database, I used SQLite for it.

enter image description here

Upvotes: 0

Views: 1183

Answers (1)

Deric Miller
Deric Miller

Reputation: 84

Try something like

SELECT SUM(cost) FROM Ride WHERE driverID = [the ID of the driver you're curious about] AND dateAndTime > [start date of your query] AND dateAndTime <= [end date of your query];

You'll have to replace the bits in square brackets with the relevant info (remember to put quotes around the two date strings).

Upvotes: 1

Related Questions