随笔分类 - sql语句
摘要:找出某张表的某个字段为空的数据 select * from table_name where column_name is null; 更新某张表,把某个字段为空的,设置为0 update istester column_name = 0 where column_name is null; 找出某
阅读全文
摘要:创建数据库my_tester CREATE DATABASE my_tester DEFAULT charset utf8; 查看数据库是否创建成功 SHOW DATABASES; 创建表 CREATE TABLE my_tester ( id INT (10) NOT NULL UNIQUE PR
阅读全文
摘要:查询代码为null且ggid不为null的公司名 select name_of_invested_company from dwtz WHERE code is NULL and ggid is not NULL
阅读全文
摘要:update 表名 set 字段名=null WHERE 条件如下例子 update dwtz set ggid=null WHERE name_of_invested_company='浙江海翔药业股份有限公司'
阅读全文
摘要:将同一个表中的一个字段2的所有值赋值给另一个字段1 UPDATE 表名 SET 字段1 = 字段2 也可以把字段所有的值赋为null UPDATE 表名 SET 字段1 = null
阅读全文
摘要:sql 查询某字段为空 select * from 表名 where 字段名 is null sql 查询某字段不为空 select * from 表名 where 字段名 is not null sql查询字段1为空且字段2不为空的数据 select * from 表名 where 字段名1 is
阅读全文
摘要:查看库里有没有这张表,有就删除 DROP TABLE IF EXISTS 表名
阅读全文
摘要:show variables like '%max_connections%';查看当前最大连接数 set global max_connections=1000重新设置最大连接数 可以在/etc/my.cnf里面设置数据库的最大连接数 [mysqld] max_connections = 1000
阅读全文
摘要:ALTER TABLE 表名 DROP COLUMN 列名#删除某一列
阅读全文