mysql 语法
-create database database_name; show databases;show tables;
| -create table table_name(column_name1 column_type,column_name2 column_type); desc table_name;
|
| -drop table table_name;
DDL--------- |-drop -drop database database_name;
(数据定义语言) |
| -alter table table_name ALTER_SPECIFICATION column_name column_definition [first/after column_name];;
|-alter -alter table table_name rename new_table_name;
|-insert -insert into table_name (field1,field2,field3.....) values (value1,value2,value3....)
| -insert into table_name (field1,field2,field3.....) values (record1_value1,record1_value2,...record1_valuen),
| (record2_value1,record2_value2,...record2_valuen);
DML--------- |-update -update table_name set field1=value1,field2=value2... where condition;
(数据操作语言) | -update table_name1,table_name2 set table_name1.field1=expr1,table_name2.field2=expr2 where condition;
|
|-delete -delete from table_name where condition;
| -delete t1,t2...from t1,t2 where condition;
|
|-select -select * from table_name where condition;
| -select * from table_name where condition order by field desc/asc;
| -select * from table_name limit(offset_start,row_count);
| -select field1,field2 fun_name from table_name /where where_contition/group by fieldn/with rollup/having where_contition;
| -select * from t1 union/union all select t2 union/union...;
|-grant select,insert on database_name.* to 'user_name'@'localhost' identified by '密码'
DCL---------|
(数据控制语言) |-revoke select,insert on database_name.* to 'user_name'@'localhost';
mysql 语法的更多相关文章
- MYSQL 语法大全自己总结的
mysql语法大全 --------数据链接---------------------数据库服务启动net start mysql --关闭服务net stop mysql --登录 -u,-p后面不 ...
- 学习mysql语法--基础篇(一)
前 言 mysql mysql语法--本篇学习都是通过使用Navicat Premium(数据库管理工具),连接mysql数据. 本篇学习主要有两个部分: 一.创建用户,创建数据库,给 ...
- 学习mysql语法--基础篇(二)
前 言 mysql mysql语法--本篇学习都是通过使用Navicat Premium(数据库管理工具),连接mysql数据. 本篇学习主要有两个部分: [SQL语句的组成] DML ...
- mysql语法之case when then与列转行
mysql语法中case when then与列转行的使用场景非常丰富. case语句类似java中条件分支语句的作用,可以类比java中的switch语句或者if语句来学习. 其语法如下: case ...
- mongo 与 传统mysql语法对比
MongoDB语法 MySql语法 db.test.find({'name':'foobar'})<==> select ...
- Mongodb与mysql语法比较
Mongodb与mysql语法比较 mongodb与mysql命令对比 传统的关系数据库一般由数据库(database).表(table).记录(record)三个层次概念组成,MongoDB是由 ...
- mongodb linux基本启动 基础增删改 mysql语法的对比
一.主流数据源类型 还存在自定义数据源以及REST接口数据,共6中数据源. 二.linux下启动连接数据库 进去mongodb的目录启动服务:mongo --host 192.168.320.826 ...
- mysql 基础篇5(mysql语法---数据)
6 增删改数据 -- ********一.增删改数据********* --- -- 1.1 增加数据 -- 插入所有字段.一定依次按顺序插入 INSERT INTO student VALUES(1 ...
- MongoDB(五)mongo语法和mysql语法对比学习
我们总是在对比中看到自己的优点和缺点,对于mongodb来说也是一样,对比学习让我们尽快的掌握关于mongodb的基础知识. mongodb与MySQL命令对比 关系型数据库一般是由数据库(datab ...
- mysql 语法总结
设置SQL语句所用的字符编码:set names UTF8; 判断指定的数据库是否存在:DROP DATABASE IF EXISTS 库; 开始使用指定的数据库:USE 库; 创建数据库CREAT ...
随机推荐
- 浅谈 C++ 中的 new/delete 和 new[]/delete[]
在 C++ 中,你也许经常使用 new 和 delete 来动态申请和释放内存,但你可曾想过以下问题呢? new 和 delete 是函数吗? new [] 和 delete [] 又是什么?什么时候 ...
- ssh无密码登录The authenticity of host 'localhost (::1)' can't be established.
The authenticity of host 'localhost (::1)' can't be established. http://blog.csdn.net/cyuyan112233/a ...
- [LeetCode] Palindrome Pairs 回文对
Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that t ...
- [LeetCode] Paint Fence 粉刷篱笆
There is a fence with n posts, each post can be painted with one of the k colors. You have to paint ...
- SqlServer按中文数字排序
表数据: 按名称排序 并不能得到一二三四五六的顺序 select * from LiWei order by name 找到中文数字在'一二三四五六七八九十'的位置 select id,name,SU ...
- JavaScript检测对象的类属性
function classof(o) { if(o === null) { return "Null"; } if(o === undefined) { return " ...
- C与指针(结构体指针,函数指针,数组指针,指针数组)定义与使用
类型 普通指针 指针数组(非指针类型) 数组指针 结构体指针 函数指针 二重指针 定义方式 int *p; int *p[5]; int (*p)[5]; int a[3][5]; struct{.. ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- neo4j-java连接
本例使用neo4j3.0.1架包 使用maven下载架包 <!-- https://mvnrepository.com/artifact/org.neo4j/neo4j-jdbc-driver ...
- Java的修饰符
转自:http://blog.csdn.net/manyizilin/article/details/51926230#L42 修饰符: 像其他语言一样,Java可以使用修饰符来修饰类中方法和属性.主 ...