![]() |
Need Help with SQL
hi, im trying to set up a SQL database for our teams scouting needs. I have NO idea how to do any of this stuff. I have the SQL server, and i know how to set up tables and stuff, but i have no idea how to enter info or access it.
|
Re: Need Help with SQL
for access, just using the command line you type something like this
SELECT t.team_number=384, d.drive_type=hyper; FROM team t, drive d; if you don't have multiple tables, and the info is just in the rows it goes like this SELECT team_number=384, drive_type=hyper; FROM team; for entering info, i will get back to you, i need to find my Oracle 9i and SQL notes from last year in OIA. But I will let you know. ivey Found my notes, you need to use the INSERT INTO command, and then give the colums to insert info in, and then the corresponding data. After you type the inital command you need to put the name of the table, and then after that the schema. The whole thing looks like this: INSERT INTO RoboInfo.SchemaIvey (drive_train, wheels) VALUES (hyper, MonsterTruck); If you have any more questions search for information on Data Manipulation Language, or DML in SQL. Here is also a tutorial that helped me get through my Oracle class last year: SQL Help and Tutorial |
Re: Need Help with SQL
in all of these examples, "..." just means you can have as many fields as you want.
basic insert: Code:
INSERT INTO table (field1, field2, ...) VALUES ("field1data","field2data",...);Code:
INSERT INTO table SET field1="field1data", field2="field2data", ...;Code:
SELECT * FROM table;Code:
SELECT field1,field2,... FROM table;Code:
SELECT * FROM table WHERE field3="field3value";Code:
SELECT * FROM table ORDER BY field3;Code:
SELECT * FROM table LIMIT number;Code:
DELETE FROM table;Code:
DELETE FROM table WHERE field1="field1data";Code:
SELECT userid,username FROM users WHERE usergroup="test" ORDER BY userid LIMIT 30; |
Re: Need Help with SQL
For SQL tutorials (and a slew of others), W3Schools.org is the site to goto.
|
Re: Need Help with SQL
If you have PHP available, I would suggest using PHPMyAdmin. It makes using mySQL so much easier.
(I am assuming that you are using mySQL, you didn't specify) |
Re: Need Help with SQL
yeah i have PHPmyAdmin and mySQL. Being a web design noob, i still cant figure it out.
|
Re: Need Help with SQL
www.webmonkey.com has some pretty good PHP+MySQL tutorials also.
|
Re: Need Help with SQL
I think your problem lies in connecting to the database using PHP or whatever else you may be using. I don't know much PHP, but i'm guessing it shouldn't be more than 10 lines of code to set up a connection, and then use some of the SQL statements that were mentioned above.
Of course if it were up to me, I wouldn't use PHP in the first place (ColdFusion is way more straight forward), but that's another topic... |
Re: Need Help with SQL
Quote:
Here's the smallest way to connect to a db IMO (incase you are having trouble with connecting): PHP Code:
|
Re: Need Help with SQL
Quote:
PHP Code:
|
Re: Need Help with SQL
Heh, thanks. I thought I didn't do the coding right. But yea, that example works the best. (IMO though, it might be safer to close the connection on your own anyways, incase PHP forgets to do that)
|
| All times are GMT -5. The time now is 14:06. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi