zoukankan      html  css  js  c++  java
  • sql 数据库表的基本操作

    create database temp_database
    
    use temp_database
    --创建表
    create table testtable(
        ID int primary key not null,
        name varchar(50) not null,
    )
    
    go
    
    --插入数据
    insert into testtable values(1,'tom')
    insert into temp_database..testtable values(2, 'jerry')
    
    go
    
    --查询表内数据
    select * from testtable where ID = 1
    --select * from temp_database..testtable where ID = 1
    
    go
    
    --修改表内数据
    update testtable set name = 'chen' where ID = 1
    
    go
    --删除表内数据 delete testtable where ID = 2 --清空表内数据 delete testtable truncate table testtable --这两个删除方式的差别是 --delete 只把数据移除 计数器等状态保持原状 --truncate 把数据表所有信息置为初始状态 go drop database temp_database
  • 相关阅读:
    web.xml
    web.xml hello1代码分析
    annotation
    injection
    container
    build tool
    version control
    url与uri的区别
    函数式语言
    http协议解析过程
  • 原文地址:https://www.cnblogs.com/yl1993/p/3843330.html
Copyright © 2011-2022 走看看