常用的sql语句如下,应对工作足以 1.查询指定字段 select c_id,c_age,c_name from t_student; select c_id as 编号,c_name as 姓名,c_age 性别 from t_student; 2.去重查询 select distinct c_address from t_student select distinct c_address,c_name from t_student 3.比较运算符查询 select c_name,c_gend
sql server 2005: --SQL SERVER 2005 生成代码需要知道的SQL语句 use LibrarySystem --查询当前数据库所有表和其的主键字段,字段类型,长度,是否为空值 SELECT d.name as 'TableName',a.name as 'FieldName',b.name as 'TypeName',a.length as 'Length',a.isnullable as 'IS_NULL' FROM syscolumns a, systypes b
#数据库MySQL 6.7 use sakila; #查询表名 show tables; # SELECT TABLE_NAME,TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='sakila'; select column_name from information_schema.columns where table_schema='sakila' and table_name='actor'; #表结构 字段名, 类
mysql数据库表及数据准备语句: USE test; DROP TABLE IF EXISTS `teacher_table`; DROP TABLE IF EXISTS `student_table`; CREATE TABLE `teacher_table` ( `id` ) NOT NULL AUTO_INCREMENT, `tName` ) NOT NULL DEFAULT '老师名字', PRIMARY KEY (`id`) ) ENGINE = INNODB DEFAULT CHA