mysql目养;
登錄:
mysql:mysql -u root proot;
創(chuàng)建數(shù)據(jù)庫:;(推薦使用此代碼創(chuàng)數(shù)據(jù)庫)
?create database tyble(庫名) default charset utf8 collate utf8_general_ci厕鹃;
搜索所創(chuàng)建的數(shù)據(jù)庫:
show databases否灾;
打開數(shù)據(jù)庫掏湾;(tyble是所創(chuàng)建的數(shù)據(jù)庫)
use tyble
創(chuàng)建數(shù)據(jù)表;
create table tyble_form(form_id int,form_name varchar(20),form_attribute varchar(20));
表里添加內(nèi)容 insert
insert into tyble_form(列1宛官,列2媒咳,列3)values(值1,值2,值3);
打開數(shù)據(jù)表蜜徽;
show tables;
打開數(shù)據(jù)表 顯示數(shù)據(jù)類型和列名祝懂;
describe tyble;
讀取列表里所有的內(nèi)容:
select * from table拘鞋;
修改列表某一列的數(shù)據(jù)類性砚蓬;數(shù)據(jù)類型可以任意修改?
alter table?tyble_form modify list_name tinyint(20);
修改列表里的內(nèi)容 update語句;
update tyble_form set? list_name='輸入想修改的內(nèi)容' where(輸入條件內(nèi)容 列:list_id=1);
末尾新加一個列: list_date(為新創(chuàng)建的列表名)? ? ? datetime(為數(shù)據(jù)類型)??
alter table tyble_form add column list_date datetime not null;
列出列的數(shù)據(jù)類型:
show create table tyble_form;
刪除MySQL數(shù)據(jù)表的通用語法:
drop table tyble_name ;
刪除表內(nèi)數(shù)據(jù)盆色,用?delete灰蛙。格式為? 刪除條件指的是例如 (list_id=1)
delete from 表名 where 刪除條件;
刪除表里的某一行的數(shù)據(jù)
delete from tyble_form where T_name = "張三";
?utf8(萬國碼)