- SHOW DATABASES;
- CREATE DATABASE pets;
- USE pets;
- SHOW TABLES;
CREATE TABLE cats ( id INT unsigned NOT NULL AUTO_INCREMENT, # Unique ID for the record name VARCHAR(150) NOT NULL, # Name of the cat owner VARCHAR(150) NOT NULL, # Owner of the cat birth DATE NOT NULL, # Birthday of the cat PRIMARY KEY (id) # Make the id the primary key );
- DESCRIBE cats;
INSERT INTO cats ( name, owner, birth) VALUES ( 'Sandy', 'Lennon', '2015-01-03' ), ( 'Cookie', 'Casey', '2013-11-13' ), ( 'Charlie', 'River', '2016-05-21' );
- SHOW CREATE TABLE cats\G;
- SELECT * FROM cats;
SELECT name FROM cats WHERE owner = 'Casey'; - DELETE FROM cats WHERE name='Cookie';
- ALTER TABLE cats ADD gender CHAR(1) AFTER name;
- ALTER TABLE cats DROP gender;
- tee /link/to/outputfile;
Thursday, November 2, 2017
MySQL Command-Line Tool: tutorial
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment