|
Posted by Captain Paralytic on 01/26/07 10:04
On 26 Jan, 09:00, "Niel Darren" <n...@pszzxasm.co.uk> wrote:
> Hi,
>
> I am a total newbie with SQL-statements, but hope you can help me, i have a
> few questions:
>
> 1. How can i get the number of rows/records in a table with a SQL statement
> ?
either SELECT COUNT(*) FROM table
or if you are using the MyISAM engine SHOW TABLE STATUS LIKE 'table'
>
> 2. I have a record looking like this:
> ID, TIMESTAMP (hh:mm:ss), datastring
TiIMESTAMPs are usually 'YYYY-MM-DD HH:MM:SS', if you are only storing
hh:mm:ss then it is a TIME. When you do your query between 2 times, it
will then return values between those times for all days. Is that what
you want?
>
> Is it possible with a SQL-statement to for example extract all records
> between one timestamp to another in that format or should i convert it into
> a unixtimestamp instead for simplicity ?
>
> 3. Is it possible to do calculations ? i have another table with: ID,
> TIMESTAMP, graph x-point value
> Then i want to instruct it to extract from one time to another, and give
> me the average of all theese values (only asking if i can do it with SQL, if
> not i can do it with code ofcourse).
>
> Do you have a link to a PDF or similar resource that is useful for a SQL
> newbie so i could get an insight in SQL - as i said, i am not much into it.
>
> Thanks alot.
[Back to original message]
|