sql语句
select *from student
select student_id from student
select student_id ,student_name from student
select student_id student_name from student 将student_name 作为student_id的别名处理
如: select student_id a from student
select a=student_id from student
从student表中分别检索出学生的学号、姓名信息并分别加上“学生”、“学号”的标题信息。
select 学号=student_id,学生=student_name from student
大部分查询都不是针对表中所有行的查询,而是从整个表中选出符合条件的信息,要实现这样的查询就要用到
从student_course表中检索成绩小于60分的学生信息。
select grade from student_course where grade<60
select * from student_course order by student_id
select top 50 percent *from student_course order by student_id 输出总行数的一半
select top 10 *from student_course order by student_id 输出前10行
‘2007-11-18’ convert cast
date'2007-11-18'
student_course表中检索成绩介于60至80分之间的学生信息。
select student_id,grade from student_course where grade between 60 and 80
从student_course表中检索学号为‘g9940202’,‘g9940204’,‘g9940206’的学生信息。
select *from student_course where (student_id='g9940202')or(student_id='g9940204')or(student_id='g9940206')
select *from student_course
select distinct student_id from student_course
select *from student_course where (student_id='g9940202')or(student_id='g9940204')or(student_id='g9940206') order by student_id
从student表中分别检索出姓张的所有同学的资料;名字的第二个字是“红”或“虹”的所有同学的资料
select *from student
select *from student where student_name like '张%'and student_name like '%红'or student_name like '%虹'
select *from student where student_name like '_[红,虹]%'
SELECT * from student WHERE student_name LIKE '_[红,虹]%'
SELECT * from student WHERE student_name LIKE '_[^红,虹]%'
SELECT * from&nbs
相关文档:
32
位的操作系统只能用
4G
的内存(不确定这句话是否正确),因为
2
的
32
次方是
4G
。默认的情况下,操作系统给自己留了
2G
,剩下的
2G
给应用程序。所以,每个应用程序所能使用的内存,最大不超过
2G
。据说可以改
WINDOWS
的
BOOT.INI
,强制操作系统只使用
1G
,即使这样,应用程序也至多是
......
#Region " 命名空间 "
Imports System.Data
Imports System.Data.SqlClient
#End Region
Public Class DBCommon
Implements IDisposable
#Region " 成员变量 "
Private conn As SqlConnection
Private cmd As SqlCommand
Private trans As SqlTransaction
#End Region
#Region " 构造函数 "
......
--显示版本号,当前日期
SELECT VERSION(),CURRENT_DATE(),NOW();
--免费的计算器
SELECT (20+5)*4 AS RESULT,SIN(PI()/3);
--创建数据库
CREATE DATABASE databasename;
--删除数据库
DROP DATABASE databasename;
--显示当前存在的数据库
SHOW DATABASES;
--选择数据库
USE ......
SQL Server 得到行号的SQL
使用临时表:
select id=identity(int,1,1),value into #temp from YourTable
select * from #temp
drop table #temp
取得第11到20行记录:
select IDENTITY(in ......
在iBatis 2.x中,可以使用$xxxx$语法在SQL中定义可动态插入的SQL元素。而在iBatis 3.x中已经发生了很大变化。
首先,语法变为 ${xxxx} 形式;
其实,你要使用的SQL元素必须是一个Java Bean的属性,也说是输入参数必须为Java Bean;在说明文档中也没有说明如何直接使用一个String类型的输入参数。
于是,我用DEBUG分析了i ......