1.The SQL introuduction
Introducing Oracle Database 11g
List the features of Oracle Database 11g
Discuss the basic design, theoretical and physical aspects of a relational database
Categorize the different types of SQL statements
Describe the data set used by the course
Log onto the database using the SQL Developer environment
Save queries to files and use script files in SQL Developer
Retrieving Data Using the SQL SELECT Statement
List the capabilities of SQL SELECT statements
Generate a report of data from the output of a basic SELECT statement
Select All Columns
Select Specific Columns
Use Column Heading Defaults
Use Arithmetic Operators
Understand Operator Precedence
Learn the DESCRIBE command to display the table structure
Restricting and Sorting Data
Write queries that contain a WHERE clause to limit the output retrieved
List the comparison operators and logical operators that are used in a WHERE clause
Describe the rules of precedence for comparison and logical operators
Use character string literals in the WHERE clause
Write queries that contain an ORDER BY clause sort the output of a SELECT statement
Sort output in descending and ascending order
Using Single-Row Functions to Customize Output
Describe the differences between single row and multiple row functions
Manipulate strings with character function in the SELECT and WHERE clauses
Manipulate numbers with the ROUND, TRUNC and MOD functions
Perform arithmetic with date data
Manipulate dates with the date functions
Using Conversion Functions and Conditional Expressions
Describe implicit and explicit data type conversion
Use the TO_CHAR, TO_NUMBER, and TO_DATE conversion functions
Nest multiple functions
Apply the NVL, NULLIF, and COALESCE functions to data
Use conditional IF THEN ELSE logic in a SELECT statement
Reporting Aggregated Data Using the Group Functions
Use the aggregation functions in SELECT statements to produce meaningful reports
Create queries that
相关文档:
现要求查询界面:不论15位或者18位身份证号都能查询出数据库中所有当前用户信息。
方案1:
create or replace function CONVERT_ID_15 (/*转换身份证号为15位*/
p_id2 in varchar2
) return varchar2
is
p_id varchar2(20);
id varchar2(15);
begin
p_id:=ltrim(p_id2);
p_id ......
1、select 1 from mytable;与select anycol(目的表集合中的任意一行) from mytable;与select * from mytable 作用上来说是没有差别的,都是查看是否有记录,一般是作条件用的。select 1 from 中的1是一常量,查到的所有行的值都是它,但从效率上来说,1>anycol>*,因为不用查字典表。
2、查看记录条数可以用select ......
最近一直在学习SQL server的内容。昨天考了一下试。感觉真的是不容易啊。特别是一些复杂的查询。搞得我头昏脑胀的。不过也是由于自己的知识掌握的还不够扎实啊。所以今天复习了一下T-SQl语句的增删改查。发现的确是有很多都忘记了。现在把结果写出来。以后可不要忘了呀。
--SQL语句复习 --一,插入insert语句 --1,ins ......
Select * from tableName
exec('select * from tableName')
exec sp_executesql N'select * from tableName' -- 请注意字符串前一定要加N
2:字段名,表名,数据库名之类作为变量时,必须用动态SQL
declare @fname varchar(20)
set @fname = 'FiledName'
Select @fname from tableName -- 错误,不会提示错 ......
作者: sealyu 日期:2008-04-17
在SQL Server 中,如果给表的一个字段设置了默认值,就会在系统表sysobjects中生成一个默认约束。
如果想删除这个设置了默认值的字段(假设此字段名column1),
执行“ALTER TABLE table1 DROP COLUMN column1”时就会报错:
The object 'DF__xxxxxxxxxxx' ......