Re: [SQL] a newbie's question on language syntax
On Thu, 26 Aug 1999, Jack Lee wrote:
> commands. The database I was working on is named
> "mysql", but the prompt of the interactive mode
> is also called mysql:
Be sure not to name your own databases mysql. That database is used by
mysql to store its permissions information and things.
> mysql->select *
> ->SELECT *
> ->select * from mysql
> ->SELECT * FROM mysql
You have to put a semicolon (;) at the end of your statements. If you
don't, it thinks you are entering a multiple line command.
Also, you can't select from a database. Databases contain multiple
tables; you have to select from the tables. So you could do:
use mysql;
select * from user ;
That would give you a list of all the user accounts MySQL has (which don't
correspond necessarily to user accounts on the system) provided you are
logged onto MySQL as root. I think you have to use a commandline option
to the mysql client for that, but I don't remember what it is.
> matter how I tried using "select" or "show". BTW,
> I'm just wondering does commands have to be small
> latters or big letters?
It doesn't matter. I know that SQL data is case sensitive, but I don't
think any of the commands, nor the names of databases or tables, are case
sensitive.
Reply to: