You are viewing our Forum Archives. To view or take place in current topics click here.
sql help with select commands
Posted:

sql help with select commandsPosted:

RockstarGames
  • Christmas!
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
Im trying to select between two dates and calculate the total between these dates.

Here is what i have so far:

select VET_ID, VISIT_DATE, COST,
from medication
GROUP BY VISIT_DATE;

No idea

plz help

[ Register or Signin to view external links. ]
#2. Posted:
Katsumi
  • Supporter
Status: Offline
Joined: Jan 23, 201113Year Member
Posts: 17,169
Reputation Power: 2031
Status: Offline
Joined: Jan 23, 201113Year Member
Posts: 17,169
Reputation Power: 2031
I'm assuming that you're working with some sort of DBMS here (Database Management System)

I did a bit of work with SQL last year so i may be able to help.

Are you provided with some sort of database/schema as reference?
#3. Posted:
RockstarGames
  • Shoutbox Hero
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
Yea i have this to enter commands and stuff,

[ Register or Signin to view external links. ]


Here is the tables that might be needed,

[ Register or Signin to view external links. ]

[ Register or Signin to view external links. ]
#4. Posted:
-Deano
  • Spooky Poster
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
By the schema, he means the names of all the different tables.

Ideally, you would have an entity-relationship diagram that will define each table and the attributes given for each one.

e.g.

Pet
- Species
- Breed
- Name
- Age

Appointment
- Date
- Vet_ID
- Job
- Pet

etc. with each table showing the relationship between other tables. (1-to-1 or 1-to-many)

Something like this:
[ Register or Signin to view external links. ]


To work out the total cost prescribed by each vet, I would create a new compound attribute that combined each unique vet with their total cost. Increment the value for each attribute depending on which vet had set the prescription.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.