MySQL select 函数
1,各种类型都有
2,用于获取无参数信息的有:
select PI(),RAND(),CURDATE(),CURRENT_DATE(),CURRENT_TIMESTAMP(),CURTIME(),LOCALTIME(),LOCALTIMESTAMP(),NOW(),SYSDATE(),CONNECTION_ID(),CURRENT_USER(),DATABASE(),LAST_INSERT_ID(),SESSION_USER(),SYSTEM_USER(),USER(),VERSION();
3,感兴趣的有:
select CURRENT_TIMESTAMP(),CONNECTION_ID(),CURRENT_USER(),DATABASE(),LAST_INSERT_ID(),USER(),VERSION();
4,更多信息:
show databases;
use somedatabase;
show tables from somedatabase;
show columns from somedatabase.sometable;
show index from somedatabase.sometable;
show table status from somedatabase;
5,更高级信息:
show columns from mysql.servers;
show columns from mysql.user;
show columns from mysql.db;
show columns from mysql.default_roles;
show columns from mysql.grant_roles;
show columns from mysql.password_history;
show columns from mysql.tables_priv;
6,高高级信息:
show tables from information_schema;
show columns from information_schema.tables;
select table_name,table_type,table_rows,table_comment from information_schema.tables;
show columns from information_schema.columns;
select table_name,column_name,data_type,column_key from information_schema.columns;
select TABLE_SCHEMA,table_name,column_name,data_type,column_key from information_schema.columns;
7,灵活运用
select TABLE_SCHEMA,table_name,column_name,data_type,column_key from information_schema.columns;
8,补充:
where,where like,union,order by,group by,join
9,sql注入:所谓SQL注入,就是通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令。
浙公网安备 33010602011771号