--SQL查询每个表的字段数量select b.[name], count(*) As AllCount,ISNULL(ISNULL(sum(case when isnullable=0 then 1 end),null),null) as NotNullCountfrom syscolumns aINNER JOIN( select [id], [name] from [sysobjects] where [type] = 'u' ) AS b ON a.id = b.[id] GROUP b
MySql提供慢SQL日志的功能,能够记录下响应时间超过一定阈值的SQL查询,以便于我们定位糟糕的查询语句. 首先,查询当前mysql数据库是否开启了慢查询日志功能: show VARIABLES like '%slow%'; slow_query_log的值是ON,代表当前数据库已经开启了慢查询功能.slow_query_log_file表示慢日志的路径. 还可以查看超过多少秒算是慢查询: show VARIABLES like 'long_query_time'; 默认是10秒,这里已经被配
9.3. 创建数据库表 创建student表 CREATE TABLE IF NOT EXISTS mydb1.student (name STRING, age INT, contact INT ); 创建employ表 create table employee (Id INT, name STRING, age INT,address STRING, salary BIGINT); 9.3.1. 数据库表中插入数据 insert into employee (ID,NAME,AGE,ADD