Mysql entry study (six)

xiaoxiao2021-03-06  68

Copy from http://comp4.com/index.php mysql Getting Started (6) Modify and Backup, Batch Processing

Add time: 11 May 2004 10:57 Views: 614 Sometimes we need to modify and delete the database table and the database, you can implement: 1, add a column: In the metable table in the previous example A list indicates whether the single SINGLE: MySQL> ALTER TABLE MYTABLE ADD Column Single Char (1); 2, modify the record of the SINGLE record of ABCCS to "Y": mysql> Update myTable set single = 'y' where name = 'abccs' Now let's take a look at what happened: mysql> select * from myTable; ---------- ---- ---------- - --------- -------- | Name | SEX | Birth | BIRTHADDR | SINGLE | ---------- ---- - ----------- ----------- ------ | Abccs | f | 1977-07-07 | China | Y | | Mary | f | 1978-12-12 | USA | NULL | | Tom | M | 1970-09-02 | USA | NULL | ---------- ------ - --------- ---------- -------- 3, before adding the record, how to add a record, for easy view, repeat This: mysql> INSERT INTO MyTable -> Values ​​('ABC', 'F', '1966-08-17', 'China', 'N'); Query Ok, 1 ROW Affected (0.05 sec) check: mysql > select * from mytable; ---------- ---- ---------- ----------- -------- | Name | SEX | BIRTH | BIRTHADDR | SINGLE | ---------- ------ --------- - ----------- -------- | Abccs | f | 1977-07-07 | China | Y | | Mary | F | 1978-12-1 2 | USA | NULL | | Tom | M | 1970-09-02 | USA | NULL | | ABC | F | 1966-08-17 | China | N | ---------- - ---- ------------ --------- ------ 3, delete records to delete the table with the following command A record: mysql> delete from mytable where name = 'abc'; delete removes a record that satisfies the conditions given by WHER.

转载请注明原文地址:https://www.9cbs.com/read-121250.html

New Post(0)