PDA

Click to See Complete Forum and Search --> : What is SQL??????


dflw
Jul 4th, 2001, 04:55 PM
Hello m8s,

I know this may sound stupid, but what is SQL and what can I do with it? I just installed it on my system.

Vlatko
Jul 5th, 2001, 05:07 AM
I am not an expert on SQL (structured query language), but i know it is a language for manupulating and creating databases. It is very very easy and can be used in VB.
And what do you mean you've installed it. Have you installed MySQL or SQL Server.

Wak
Jul 7th, 2001, 07:31 PM
It is a 4th generation language, very similar to english, and easier to learn than HTML. You can pick it up and start using it with 2 nights. :)

chrisjk
Jul 8th, 2001, 04:37 PM
hasn't got anything to do with API though ;)

Wak
Jul 8th, 2001, 05:54 PM
I think your getting confused. Say you have like a huge database of data. Now it has columns, and rows. In the columns, there are names, ages, and addresses. And down the sides you have say Bill, age 40, 25 smith st ect.. like this

NAME AGE ADDRESS
Bill 40 25 smith st
Jane 36 80 Joshn st
Luke 27 16 mary st
--------------------------------------------------------------------

Anyway, and you want to include that in your program.
And people want to be able to ask questions to the database here which you have. Like how many people are over 30 and what is the average age? Or if the list was quite large, how many lukes are there. ect... u get my picture. We u do this using sql.
For this sake, we want the average age. So we get our string and fill it.


strSQLstatement = "Select sum(age)/3 FROM PersonalDetais"


That simple. And then we have our data object, of which everything is linked to, so we go:


dataPersonalDetails.Recordset = strSQLstatement


I'm not entirley sure about that last part, but it something similar, I'm to lazy to go and check inside the IDE. sorry.

That's what you use SQL for. :) :)

Frans C
Jul 9th, 2001, 09:40 AM
Originally posted by Wak
I think your getting confused. Say you have like a huge database of data. Now it has columns, and rows. In the columns, there are names, ages, and addresses. And down the sides you have say Bill, age 40, 25 smith st ect.. like this

NAME AGE ADDRESS
Bill 40 25 smith st
Jane 36 80 Joshn st
Luke 27 16 mary st
--------------------------------------------------------------------

Anyway, and you want to include that in your program.
And people want to be able to ask questions to the database here which you have. Like how many people are over 30 and what is the average age? Or if the list was quite large, how many lukes are there. ect... u get my picture. We u do this using sql.
For this sake, we want the average age. So we get our string and fill it.


strSQLstatement = "Select count(age)/3 FROM PersonalDetais"


That simple.

This proves that SQL isn't as easy as most people have said.
Because databases can be pretty complex, the SQL to retrieve the requested information can be preety complex as well.

Your SQL command will retrieve the number of ages in the table and devide it by three. If there are three records it will return the value 1, and if there are 6 records it will return 2.
I think you meant to use
strSQLstatement = "Select sum(age)/3 FROM PersonalDetais"
but this will only return the average age if there are three records in the table.
The correct way to get the average age is:
strSQLstatement = "Select avg(age) FROM PersonalDetais"

Wak
Jul 10th, 2001, 07:12 AM
he he, tired. Yeah sum(). Thanx Frans C. But yeh, it is an easier language to learn.