Before Basic SQL

本文介绍了SQL的基础语法,包括大小写敏感性、关键字使用规范、空值定义及处理、算术表达式创建、别名定义、字符串连接以及去除重复行的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

SQL statements are not case sensitive

SQL statements can be on one or more lines

Keywords cannot be abbreviated or split across lines

[@more@]Clauses are usually placed on separate lines

Indents are used to enhance readability


------------------------------------------------------------------------------------------------------------------
Column Heading Defaults

1.iSQL*Plus
- Default heading justification:Center
- Default heading desplay:Uppercase

2.SQL*Plus
- Character and Date column headings are left-justified
- Number column headings are right-justified
- Default heading display:Uppercase

Displaying Table Structure:
DESC[RIBE] table_name;
DUAL is a dummy table you can use to view results from functions and calculations

------------------------------------------------------------------------------------------------------------------
Create expressions with number and date data by using arithmetic operators.
+ : Add
- : Subtract
* : Multiply
/ : Divide

Operator Precedence: * / + -
- Multiplication and division take priority over addition and subtraction
- Operators of the same priority are evaluated from left to right
- Parentheses are used to force prioritized evaluation and to clarify statements


------------------------------------------------------------------------------------------------------------------
Defining a Null Value
- A null is a value that is unavailable,unassigned,unknown,or inapplicable
- A null is not the same as zero or a blank space

Null Values in Arithmetic Expressions:
Arithmetic expressions containing a null value evaluate to null


------------------------------------------------------------------------------------------------------------------
Defining a Column Alias
A column alias:
- Renames a column heading
- Is useful with calculations
- Immediately follows the column name - there can also be the optional AS keyword between the column name and alias
- Requires double quotation marks if it contains spaces or special characters or is case sensitive


------------------------------------------------------------------------------------------------------------------
Concatenation Operator
- Concatenates columns or character strings to other columns
- Is represented by two vertical bars(||)
- Creates a resultant column that is a character expression


------------------------------------------------------------------------------------------------------------------
Literal Character Strings
- A literal is a character,a number,or a date included in the SELECT list
- Date and character literal values must be enclosed within single quotation marks
- Each character string is output once for each row teturned


------------------------------------------------------------------------------------------------------------------
Duplicate Rows
- The default display of queries is all rows,including duplicate rows
- If you don't need the duplicate rows , using the keyword DISTINCT

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8633028/viewspace-906309/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8633028/viewspace-906309/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值