Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 23rd, 2006, 4:12 AM   #1
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
Add all fields in table

I have this table and its got a field name called value.
I would like to add up all the values and then purge it from the database.
any suggestions?
Thank you
werner
wernervt is offline   Reply With Quote
Old Mar 24th, 2006, 5:39 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Using SQL:
SELECT SUM(value) FROM table
DELETE FROM table

(assuming "purge it" means "purge everything")
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 24th, 2006, 6:48 PM   #3
Silvanus
Hobbyist Programmer
 
Silvanus's Avatar
 
Join Date: Aug 2005
Location: Hiding from... them...
Posts: 110
Rep Power: 4 Silvanus is on a distinguished road
TRUNCATE can also be used (at least in mysql) to remove all rows; it also resets auto-incrementing fields.
__________________
:wq
Silvanus is offline   Reply With Quote
Old Mar 27th, 2006, 12:24 AM   #4
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
Thank you for your help! Im not using SQL though. ive just got an .dbf database. I just want to add all the records in a certian field and then purge them to a backup database.
Thank you for your swift response!
I really appreciate your help
Werner
wernervt is offline   Reply With Quote
Old Mar 28th, 2006, 4:57 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
The extension "DBF" is apparently used by a number of different database applications. Which one are you using?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 30th, 2006, 4:27 AM   #6
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
dbaseIV
wernervt is offline   Reply With Quote
Old Mar 31st, 2006, 9:13 AM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
That's roughly fifteen years old, and uses its own proprietary query language, as opposed to the industry standard, SQL. I suggest a more recent DB application - MySQL or PostgreQL, perhaps? Of course, if you're tied in to this specific database software, you'll need to learn the query language. I couldn't find much on it myself - good luck.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 3rd, 2006, 12:59 AM   #8
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
thanks for your help. I think i should start using SQL. is there any forums i can join to find out about how to construct an sql database and where to find a free sql program. how do you start in sql? i dont know anything about sql.

Thank you for all your help thus far
wernervt is offline   Reply With Quote
Old Apr 3rd, 2006, 6:05 PM   #9
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
OK, let's start from the beginning. SQL stands for Structured Query Language, and is the language you need to know when working with databases. Most database software understands SQL.

There are two main things you need to do with databases: retrieve and manipulate information. SQL provides ways to do both. To retrieve information:
SELECT forename, surname FROM people WHERE person_id > 10 ORDER BY surname;
That's a typical SQL statement, and it does a lot. It looks up the people table, and gets the forename and surname of every person with an ID number greater than 10. It then returns the list of people ordered by surname. As you can see, it's a very powerful language.

Now imagine we have a table with three columns: person_id, forename and surname. How would we put something in there?
INSERT INTO people VALUES (4, "John", "Smith");
Easy, no?

I suggest you pick up a book on SQL to find out all the different things you can do with it. To use it, you'll obviously need some database software. As I mentioned earlier, MySQL and PostgreSQL are two of the best. Download one of them and install it, and if you have any problems, let us know.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 4th, 2006, 2:51 AM   #10
wernervt
Newbie
 
Join Date: Mar 2006
Posts: 10
Rep Power: 0 wernervt is on a distinguished road
I was on the net reading up on sql language and i think it is a very powerfull language. i love building programs in delphi using databases. but i do not know waht database to use since dbase and bde is no longer supported and the growth limit is only 2GB wich is small. I would like to know what database structure to use and what opensource program can i use to construct the database. also can i use acess to make one or is the database desktop in delphi sufficient and if so wich database format. can you see my predicament. thank you for your advice. i am going to buy a book on sql but i dunno how to integrate it with a delphi program ect. i am still a novice.

Thank you very much!
Werner
wernervt is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:00 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC