Difference between revisions of "MySQL"

Jump to navigation Jump to search
299 bytes added ,  10:10, 22 February 2011
Added SHOW
(→‎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>


Navigation menu