Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Basic MySQL

Connect to the local database server as user nhds:

  $ mysql -u nhds -p

Identify the current database:

  mysql> select DATABASE();
  +------------+
  | DATABASE() |
  +------------+
  |            |
  +------------+
  1 row in set (0.00 sec)

List all available databases with:

  mysql> show databases;
  +----------+
  | Database |
  +----------+
  | mysql    |
  | nhds     |
  | test     |
  +----------+
  3 rows in set (0.00 sec)

Select a particular database:

  mysql> use nhds;
  Database changed

List the available tables:

  mysql> show tables;
  +----------------+
  | Tables_in_nhds |
  +----------------+
  | nhds96         |
  | nhds97         |
  | nhds98         |
  | nhds99         |
  +----------------+
  4 rows in set (0.00 sec)

List details of the structure of a table:

  mysql> describe nhds99;
  +---------------+---------+------+-----+---------+-------+
  | Field         | Type    | Null | Key | Default | Extra |
  +---------------+---------+------+-----+---------+-------+
  | svy_year      | int(11) | YES  |     | NULL    |       |
  | newborn       | char(1) | YES  |     | NULL    |       |
  | age_unit      | char(1) | YES  |     | NULL    |       |
  | age           | int(11) | YES  |     | NULL    |       |
  | sex           | char(1) | YES  |     | NULL    |       |
  | race          | char(1) | YES  |     | NULL    |       |
  | m_status      | char(1) | YES  |     | NULL    |       |
  | dis_month     | int(11) | YES  |     | NULL    |       |
  | dis_status    | char(1) | YES  |     | NULL    |       |
  | days_care     | int(11) | YES  |     | NULL    |       |
  | los_flag      | char(1) | YES  |     | NULL    |       |
  | geo_region    | char(1) | YES  |     | NULL    |       |
  | no_beds       | char(1) | YES  |     | NULL    |       |
  | hos_ownership | char(1) | YES  |     | NULL    |       |
  | ana_weight    | int(11) | YES  |     | NULL    |       |
  | dc1           | char(5) | YES  |     | NULL    |       |
  | dc2           | char(5) | YES  |     | NULL    |       |
  | dc3           | char(5) | YES  |     | NULL    |       |
  | dc4           | char(5) | YES  |     | NULL    |       |
  | dc5           | char(5) | YES  |     | NULL    |       |
  | dc6           | char(5) | YES  |     | NULL    |       |
  | dc7           | char(5) | YES  |     | NULL    |       |
  | pc1           | char(4) | YES  |     | NULL    |       |
  | pc2           | char(4) | YES  |     | NULL    |       |
  | pc3           | char(4) | YES  |     | NULL    |       |
  | pc4           | char(4) | YES  |     | NULL    |       |
  | p_src_payment | char(2) | YES  |     | NULL    |       |
  | s_src_payment | char(2) | YES  |     | NULL    |       |
  | drg           | char(3) | YES  |     | NULL    |       |
  +---------------+---------+------+-----+---------+-------+
  29 rows in set (0.00 sec)


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.