Go to Post Does this need a "Do not try this at home" stamp? - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-02-2004, 14:41
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
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.
  #2   Spotlight this post!  
Unread 28-02-2004, 16:56
Mr. Ivey's Avatar
Mr. Ivey Mr. Ivey is offline
Mark Ivey
AKA: Mark
no team
 
Join Date: Sep 2002
Rookie Year: 2000
Location: Raleigh, NC
Posts: 171
Mr. Ivey is a glorious beacon of lightMr. Ivey is a glorious beacon of lightMr. Ivey is a glorious beacon of lightMr. Ivey is a glorious beacon of lightMr. Ivey is a glorious beacon of light
Send a message via AIM to Mr. Ivey
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
__________________
When you tell a student not to do it, you shouldn't do it. Or else you will wind up with a 3/8" drill bit in your finger... Like I did...

Last edited by Mr. Ivey : 28-02-2004 at 17:30.
  #3   Spotlight this post!  
Unread 28-02-2004, 18:16
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
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",...);
another way to insert:
Code:
INSERT INTO table SET field1="field1data", field2="field2data", ...;
basic retrieval of results:
Code:
SELECT * FROM table;
only retrieve certain fields:
Code:
SELECT field1,field2,... FROM table;
selective retrieval of results:
Code:
SELECT * FROM table WHERE field3="field3value";
ordering the results retrieved:
Code:
SELECT * FROM table ORDER BY field3;
only retrieve the first few results (up to the number specified):
Code:
SELECT * FROM table LIMIT number;
deleting all rows:
Code:
DELETE FROM table;
deleting certain rows:
Code:
DELETE FROM table WHERE field1="field1data";
you can combine just about any of the modifiers above, for example,
Code:
SELECT userid,username FROM users WHERE usergroup="test" ORDER BY userid LIMIT 30;
would give me the username and userid of the first 30 people in the users table whose usergroup is "test", ordered by their userids.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)

Last edited by deltacoder1020 : 28-02-2004 at 18:21.
  #4   Spotlight this post!  
Unread 28-02-2004, 19:27
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Re: Need Help with SQL

For SQL tutorials (and a slew of others), W3Schools.org is the site to goto.
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #5   Spotlight this post!  
Unread 28-02-2004, 22:20
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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)
  #6   Spotlight this post!  
Unread 28-02-2004, 22:51
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Need Help with SQL

yeah i have PHPmyAdmin and mySQL. Being a web design noob, i still cant figure it out.
  #7   Spotlight this post!  
Unread 29-02-2004, 02:26
KevinB's Avatar
KevinB KevinB is offline
Registered User
AKA: Alum
no team
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2001
Location: AL
Posts: 188
KevinB will become famous soon enoughKevinB will become famous soon enough
Send a message via ICQ to KevinB
Re: Need Help with SQL

www.webmonkey.com has some pretty good PHP+MySQL tutorials also.
  #8   Spotlight this post!  
Unread 29-02-2004, 17:54
pedro's Avatar
pedro pedro is offline
FIRST Alumni
#0492 (Titan Robotics Club)
Team Role: College Student
 
Join Date: Mar 2003
Location: Bellingham, WA
Posts: 32
pedro is an unknown quantity at this point
Send a message via MSN to pedro
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...
  #9   Spotlight this post!  
Unread 29-02-2004, 18:51
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Re: Need Help with SQL

Quote:
Originally Posted by pedro
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...
Just for the record, it depends on how you'd like to connect to the db on how many lines it'd take.

Here's the smallest way to connect to a db IMO (incase you are having trouble with connecting):
PHP Code:
<?php
$db 
mysql_connect_db("localhost""fred""loves_wilma");
 
mysql_connect($db);
 
mysql_close();
?>
It may not be totally correct syntax, but that's because I haven't touched PHP in a while
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #10   Spotlight this post!  
Unread 29-02-2004, 20:45
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Need Help with SQL

Quote:
Originally Posted by Raven_Writer
Just for the record, it depends on how you'd like to connect to the db on how many lines it'd take.

Here's the smallest way to connect to a db IMO (incase you are having trouble with connecting):
PHP Code:
<?php
$db 
mysql_connect_db("localhost""fred""loves_wilma");
 
mysql_connect($db);
 
mysql_close();
?>
It may not be totally correct syntax, but that's because I haven't touched PHP in a while
PHP Code:
<?php

mysql_connect
("dbhost","dbuser","dbpass") or die("could not connect to db";
mysql_select_db("dbname") or die("could not select database");
$result mysql_query("query string") or die("could not query database");

//process data

?>
(php automatically closes the database connection at the end of the script)
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #11   Spotlight this post!  
Unread 01-03-2004, 15:49
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
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)
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is your most prefered programming language? Hailfire Programming 156 19-01-2005 21:42


All times are GMT -5. The time now is 00:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi