Development of Interactive Web Pages 62-9
To.view.tables,.type.the.following.command.
mysql> SHOW TABLES;
62.4.3 Modifying tables
To.delete.a.table,.type
mysql> DROP TABLE <tableName>;
To
.in
sert
.da
ta
.in
to
.a.ta
ble,
.ty
pe
mysql> INSERT INTO <table name>
(column1, column2, …)
VALUES (value1, value2, …);
Example:
mysql> INSERT INTO employeeinfo
(LastName, FirstName, Department, Employee_ID)
VALUES (Rives, John, Sales, 2);
To
.up
date
.da
ta
.sto
red
.in.a.da
tabase
.ta
ble,
.ty
pe
mysql> UPDATE <tableName> SET
<col_name>=<new_value>, …
WHERE <where clause>;
Example:
mysql> UPDATE employeeinfo SET FirstName='Johnny' WHERE
LastName='Rives' AND Employee_ID=2;
To
.de
lete
.a.re
cord
.fr
om
.th
e
.ta
ble
mysql> DELETE FROM table_name WHERE some_column=some_value;
Example:
mysql> DELETE FROM employeeinfo WHERE LastName='Tent';
To
.de
lete
.al
l
.ro
ws
DELETE * FROM employeeinfo;
62.4.3.1
to Vie
w Data
e
.SE
LECT
.co
mmand
.is.us
ed
.fo
r
.vi
ewing
.da
ta
.sto
red
.in.yo
ur
.da
tabase
.ta
bles.
Syntax:
SELECT column_name(s) FROM table_name;
Example
.1:.To.di
splay
.da
ta
.fr
om
.co
lumns
.La
stName
.an
d
.De
partment.
mysql> SELECT LastName, Department from employeeinfo;
© 2011 by Taylor and Francis Group, LLC