mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 21:44:45 +03:00
[mysql] Add the "CONNECT" command and minor changes.
This commit is contained in:
1 file changed
+5
-3
@@ -40,6 +40,7 @@ mysql -h <host> -u <user> -p [db_name]
|
||||
| `CREATE DATABASE` db `;` | Create database |
|
||||
| `SHOW DATABASES;` | List databases |
|
||||
| `USE` db`;` | Switch to db |
|
||||
| `CONNECT` db `;` | Switch to db |
|
||||
| `DROP DATABASE` db`;` | Delete db |
|
||||
|
||||
#### Table
|
||||
@@ -47,7 +48,7 @@ mysql -h <host> -u <user> -p [db_name]
|
||||
| - | - |
|
||||
|--------------------------|----------------------------|
|
||||
| `SHOW TABLES;` | List tables for current db |
|
||||
| `SHOW fields from` t`;` | List fields for a table |
|
||||
| `SHOW FIELDS FROM` t`;` | List fields for a table |
|
||||
| `DESC` t`;` | Show table structure |
|
||||
| `SHOW CREATE TABLE `t`;` | Show create table sql |
|
||||
| `TRUNCATE TABLE `t`;` | Remove all data in a table |
|
||||
@@ -94,9 +95,10 @@ Create a new table with three columns
|
||||
|
||||
```sql
|
||||
CREATE TABLE t (
|
||||
id INT PRIMARY KEY,
|
||||
name VARCHAR NOT NULL,
|
||||
id INT,
|
||||
name VARCHAR DEFAULT NOT NULL,
|
||||
price INT DEFAULT 0
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user