2,187
edits
(→CREATE / ALTER Tables: Added further ALTER example) |
(Added SHOW) |
||
Line 166: | Line 166: | ||
SELECT COUNT(*) FROM hware WHERE make='IBM'; # Counts number of rows in selection | SELECT COUNT(*) FROM hware WHERE make='IBM'; # Counts number of rows in selection | ||
SELECT COUNT(*) AS total, SUM(IF(model='x336',1,0)) AS x336 FROM hware WHERE make='IBM'; # Additional counts number of rows where model='x336' | SELECT COUNT(*) AS total, SUM(IF(model='x336',1,0)) AS x336 FROM hware WHERE make='IBM'; # Additional counts number of rows where model='x336' | ||
</source> | |||
== SHOW == | |||
Shows general information about a database, it's tables, columns etc. | |||
<source lang="mysql"> | |||
SHOW STATUS; # Shows general info | |||
SHOW CREATE TABLE table; # Shows syntax that would be used to recreate a table | |||
</source> | </source> | ||