Forum Moderators: coopster
1) how do i check the elements or entries i've inserted into a table in mysql? I've created a table format notepad and creating a test.sql file and loading it in notepad. This works out fine, but then i try to insert into the table. (my table name is accounts)
INSERT INTO accounts (Username,
Password,
IPaddress)
VALUES ('Account 2',
'Pword for 2',
'100.1.1.2');
but how do i check if this element has been successfully inserted into the table? also, i had to enter this all from the mysql prompt. Is there nay way i can just use notepad to do all this? Also, how come the entries don't stay in the table when i reload it after closing hte mysql/dos program?
Thanks so much for the help! Sorry about the noobish questions.
To verify your entry in the table, you now use the SELECT statement.
SELECT * FROM accounts;
or maybe you just want to see certain columns:
SELECT Username, Password FROM accounts;
now sort them:
SELECT Username, Password FROM accounts ORDER BY Username;
or maybe just one user:
SELECT Password, IPaddress FROM accounts WHERE Username = 'me';
Yes, you can key all your commands into a text file and then process the text file from the command line:
mysql -u username -p databasename < mytextfile.txtUsing this syntax will prompt you for a password.
A great resource for you will be the MySQL manual. Particularly the Tutorial [dev.mysql.com] to get you started.
First of all, it should return a comment like
"x rows affected" or something like that.
If you want to see it, type in
SELECT * FROM accounts
or
SELECT * FROM accounts WHERE username='Account 2'
Tom