mysql基本語句例子 mysql常用的語句示例

2021-10-17 20:31:35 字數 857 閱讀 6080

登陸資料庫

mysql -hlocalhost -uroot -p123456         -u後面是使用者名稱            -p後面是賬號密碼           -h後面是host

檢視資料庫列表       show databases;

建立資料庫              create database test;

刪除資料庫    drop database test;

使用資料庫    use test;

檢視資料表    show tables;

建立資料表    create table test(id int not null);

刪除資料表    drop table test;

新增列      alter table test add column *** varchar(255) not null;

刪除列      alter table test drop column age;

修改列名     alter table test change name change int;

修改列屬性    alter table test modify name varchar(255);

插入資料     insert into test (`id`,`name`) values (1,"xm");

刪除資料     delete from test where id=1 and name="bgg";

修改資料     update test set id=1,name="xm" where id=2 and name="bgg";

查詢資料     select name from test where id=1;

mysql基本語句 mysql基本語句

mysql關係型資料庫rds中的老大哥,增刪改查是mysql入門的基礎 增刪改查語句 增刪改查的語句命令為 增 insert 刪 delete 改 update 查 select或者show 庫操作建立資料庫 create database shujukuba 建立帶字符集的資料庫 create d...

mysql了基本語句 MySQL基本語句大全

mysql指令碼的基本組成 與常規的指令碼語言類似,mysql 也具有一套對字元 單詞以及特殊符號的使用規定,mysql 通過執行 sql 指令碼來完成對資料庫的操作,該指令碼由一條或多條mysql語句 sql語句 擴充套件語句 組成,儲存時指令碼檔案字尾名一般為 sql。在控制台下,mysql 客...

MySQL基本語句

mysqld 啟動資料庫 mysql uroot 登陸使用者名稱或密碼 show databases 顯示所有資料庫 use 使用 資料庫 show tables 顯示該資料庫下的所有 select from table 查詢該錶 insert into table values 插入資料到表 de...