mysql基础语法(常用)
生活随笔
收集整理的這篇文章主要介紹了
mysql基础语法(常用)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- 數(shù)據(jù)庫操作
- 數(shù)據(jù)表操作
- CRUD
數(shù)據(jù)庫操作
創(chuàng)建數(shù)據(jù)庫
create database 數(shù)據(jù)庫名;create database shirompdb;選擇數(shù)據(jù)庫
use 數(shù)據(jù)庫名;use shirompdb;刪除數(shù)據(jù)庫
drop database 數(shù)據(jù)庫名;drop database shirompdb;數(shù)據(jù)表操作
創(chuàng)建數(shù)據(jù)表
create table account(id int AUTO_INCREMENT,name varchar(30) default null,password varchar(30) default null,perms varchar(30) default null,primary key(id) )engine=innodb charset=utf8;刪除數(shù)據(jù)表
DROP TABLE 數(shù)據(jù)表名 ;DROP TABLE account;CRUD
增
INSERT INTO table_name ( field1, field2,...fieldN ) VALUES ( value1, value2,...valueN );INSERT INTO account (name,password, perms) VALUES ("guohui", "123456","add:user");刪
DELETE FROM table_name [WHERE Clause];account 表 刪除id為1 的用戶 DELETE FROM account WHERE runoob_id=1;改
account表 字段是密碼 改成666666 id是1 UPDATE account SET password="666666" WHERE id =1;查
account 表 查詢 密碼=666666的用戶SELECT * from account WHERE password="666666";總結(jié)
以上是生活随笔為你收集整理的mysql基础语法(常用)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: springboot整合shiro+my
- 下一篇: vm固定ip