zoukankan      html  css  js  c++  java
  • 常用SQL语句

    1、创建数据库
        create database database_name
    
    2、删除数据库
        drop database database_name
    
    3、创建新表
        create table tablen_ame(col1 type1[not null][primary key],col2 type[not null],...)
        根据已有表来创建新表
        create table table_new like table_old
        create table table_new as select col1, col2,.. from table definition only
    
    4、删除表
        drop table table_name
    
    5、增加列
        alter table table_name add column col_name type
        
    6、添加主键
        alter table table_name add primary key(col_name)
        alter table table_name drop primary key(col_name)
    
    7、创建索引
        create [unique] index idx_name on table_ame(col...)
    
    8、查询
        select * from table_name where 范围
    
    9、插入
        insert into table_name(field1,filed2) values(value1,value2)
    
    10、删除
        delete from table_name where 范围
    
    11、更新
        update table_name set filed1=value1 where 范围
    
    12、几个简单的函数
        select sum(filed1) as sum_value from table_mame
        select value(filed2) as avg_value from table_name
        select min(filed1) as min_value from table_name
        select max(filed1) as max_value from table_name
    
    13、查询前10条
        select top 10 *from table_name
        随机选择10条记录
        select top 10 * from table_name order by newid()
    
    14、in操作符
        select * from table_name where col_name in (value11,value2,...)
  • 相关阅读:
    HTML 005 标题
    HTML 004 属性
    javascript的html编码函数 (htmlSpecialChars-处理特殊字符)
    js生成二维码实例(真实有效)
    sublime快捷键
    利用jq并且添加上cookie的网页换肤
    阻止表单的默认行为
    阻止事件冒泡
    js控制图片提示(鼠标滑过显示大图片)
    jQuery.cookie插件用法自我总结
  • 原文地址:https://www.cnblogs.com/zengyjun/p/10400708.html
Copyright © 2011-2022 走看看