SQL Learning Tip2
来源:互联网 发布:asp.net 抓取网页数据 编辑:程序博客网 时间:2024/05/21 22:49
1. alter table talbe_name add column column_name data_type (First/Before/Last/After/Fifth) (column_name) Comments: set the new column in a certain position compared with "assigned column"2. alter table table_name rename to new_table_name3. alter table table_name change column old_column_name new_column_name data_type (Not null) (Auto_Increment), add Primary key (column_name)4. alter table table_name modify column column_name new_data_type5. alter table table_name drop column column_nameSummary: 'change' is used to change both name and datatype 'modify' is used to change datatype 'drop column' is used to remove a column in table 'rename' is used to rename the table. 6. Handy String function Right(String, location)/Left(String, location): retrieve the part of the string substring_index(location, 'character', times): retrieve the part of the string substring(your_string, start_position, length) Upper(String)/Lower(String) Reverse(String)/Ltrim(String)/RTrim(String)/Length(String) Comments: all the functions just modify the returned result after querying.7. Case--End SQL Statement: Update table table_name set column_name = Case when condition1 then value1 when condition2 and condition3 then value2 ...... else valuen end 8. Math Functions: sum(),avg(), min(),max(),count() SQL: select first_name, sum(score) from cookie_sales group by first_name order by sum(score) desc (Limit number) 9. select * from tablename where column like '%keyword%' *: any number of unknown character _: one character of unknown character10: between equals <= and >=;11. select * from tableName where column in (A,B,....)12. Not/<>: not equal13. select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';14. Lower()/Upper():15. 1NF: a. Each row of data must contain atomic values b. Each row of data must have a unique identifier named "Primary Key" A primary key is a column in your table, that will make each record unique. Not null, must have value when inserting,compact, can't be changed. c. 16. Auto_increment17. Alter Table with a primary key Sql: alter table table_name add column column_name column_type (not null) (auto_increment) (First),
- SQL Learning Tip2
- iOS Tip2
- SQL Learning
- Learning SQL
- MVC TIP2:路由
- MOQ TIP2:匹配参数
- vim使用 tip2
- python技巧31[python Tip2]
- Tip2 使用默认转型方法
- Learning Oracle PL/SQL
- SQL Learning Tip
- SQL Learning Tip 3
- SQL Learning Tip 4
- SQL Learning Tip 5
- Learning SQL --集合操作
- Python SQL learning
- learning pl/sql (1) Basic
- No SQL ans rdbms learning
- 高性能网页开发的14条军规
- IT学习力
- Oracle
- 十种必备工具
- 经典的hack
- SQL Learning Tip2
- xml相关的收藏
- 组图:《赤壁》记者会 梁朝伟林志玲均否认结婚
- NEVER, NEVER trust the client
- C语言实现QQ密码大盗
- GridView事件大全
- Linux下安装JDK说明
- 对于 .NET 应用程序中执行 XSLT 转换 INFO: 路线图
- Explore.exe错误解决方法