Register  |  Login



Earn money by sharing your knowledge through Quomon's revenue sharing program

Question

Status: Closed Points: 25 Time: 06:59 - Apr 04, 2007  

sumit_rai

what is select * from command used for.And why do we give this command before giving delete command

These commands are used to disconnect a session of a user 'subscriber2' . Please tell me whatever general information you can tell me about these commands. i am a newbie to mysql.

mysql radius;
select * from radacct where username= 'subscriber2' and AcctstopTime= '0000-00-00 00:00:00';
delete from radacct where username= 'subscriber2' and AcctstopTime= '0000-00-00 00:00:00';
select * from ConnDetails where username= 'subscriber2';
delete from ConnDetails where username= 'subscriber2';

Categories:

Answer Discussion
Tutorials

 

Q&A System for Websites and Corporate Collaboration

Advertisement

  • Generates significant organic traffic for websites
  • Saves companies money, resources, and time

PeterNZ

Date:: Apr 04, 2007

Time:: 15:26

Not knowing your system in detail, I can only comment on the commands themselves and guess what they are used for:

"select * from radacct where username= 'subscriber2' and AcctstopTime= '0000-00-00 00:00:00';"

Selects all data from the table "radacct" (I guess it is Radius Account) for the user "subscriber2" where the AcctstopTime (Account Stop Time?) is set to zero.
(I assume this is used to control that the correct data is selected for the following delete statement!)

"delete from radacct where username= 'subscriber2' and AcctstopTime= '0000-00-00 00:00:00';"

Deletes the data which was selected above from the table "radacct"

"select * from ConnDetails where username= 'subscriber2';"

Selects all data from the table "ConnDetails" (I guess it is Connection Details) for the user "subscriber2" where the AcctstopTime (Account Stop Time?) is set to zero.
(Again I assume this is used to control that the correct data is selected for the following delete statement!)

"delete from ConnDetails where username= 'subscriber2';"

Deletes the data which was selected above from the table "ConnDetails"

I am not sure i n which environment you have these SQL Statements. If they are in a SQL Script, then the output should be
First the data in radacct for the user
Then a statement like "1 row(s) deleted from radacct" or something similar
Then the data for the user in ConnDetails
Then again a message saying something like "1 row(s) deleted from ConnDetails"

If you came across these SQL Statements in some program code then I guess the SELECT is done to collect data to either show on the screen or somewhere or to log the process in some log file etc.

Hope this helps

Cheers

Peter

sumit_rai

Date:: Apr 04, 2007

Time:: 23:35

We are using a Radius server for providing internet connections to ADSL ( Asymmetric Digital Subscriber Line ) users. We are giving these 4 mysql commands to forcefully disconnect a connected user from the Server. What would happen if we do not give the select commands.. and just give the delete commands. I the select command for viewing certain data from the database.... or is it a prerequisite .. before give delete command.

sumit_rai

Date:: Apr 04, 2007

Time:: 23:37

correction

* Is the select command for viewing certain data from the database.... or is it a prerequisite .. before give delete command. ???

Anpanman

Date:: Apr 05, 2007

Time:: 05:03

normally using SQL to delete registries in the database, it is not necessary to select first. The delete is sufficient. I don't know about your specific situation, but it sounds strange that it would be required to select first.

sumit_rai

Date:: Apr 05, 2007

Time:: 09:52

Thanks Anpanman ... your reply has cleared my doubts... .. i believe in our case we were told to use select command before delete command to make sure we dont type the delete command wrong ( that would be dangerous ). First we are giving the select command . if there is some typo in select command it wouldnt do no harm and we can correct it. now when we are sure that the select command is giving correct result, we just replace 'select *' with 'delete' .

Question Answered

This question has been closed, and points have been rewarded to the following experts:

PeterNZ: 25

You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

No tutorials have been submitted yet. Want to be the first?

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Databases Experts

View More

Rank

Expert

Points

1.

PeterNZ

325

2.

nidhi

310

3.

LAGM

240

4.

jgivoni

120

5.

xarcus

95

6.

joxley

50

7.

ozzie

50

8.

rcastagna

10

9.

theDude

10

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es