• 数据库设主键以及where的应用


    二、第二课

    create table teacher

    (

    tno int primary key identity(1,1),  --tno设为主键(primary key identity(1,1)

    tname varchar(50)

    )

    go

    insert into teacher values('张三')

    insert into teacher values('李四')

    insert into teacher values('王五')

    go

    select *from teacher

    go

    delete from teacher where tname='王五'

    ---查询

    select *from player where name='约里克'

    --selset *所有)from   表  where   条件

    select *from chinastates where parentareacode=37 and root=1

    --and 并且or 或 >= <=

    use Player

    create table xueshengxinxibiao 

    (

    tno int primary key identity(1,1), --设为主键 primary key identity(1,1)  从1开始,每次递增1

    name varchar(50),

    sex int,

    age int,

    cm decimal(18,2),

    kg decimal(18,2),

    idcard bigint,

    addresss varchar(50),

    )

    insert into xueshengxinxibiao values('刘凯',1,23,172,65,372328199206190313,'山东省淄博市张店区' --主键字是自动生成的(identity(1,1)),不用自己输入

    insert into xueshengxinxibiao values('约里克',1,23,172,65,372328199206190313,'山东省淄博市张店区')

    insert into xueshengxinxibiao values('111',1,23,172,65,372328199206190313,'山东省淄博市张店区')

    insert into xueshengxinxibiao values('222',1,23,172,65,372328199206190313,'山东省淄博市张店区')

    select *from xueshengxinxibiao

    update xueshengxinxibiao set name='五庄观' where tno=3  --tno=3的这一行改成name='五庄观'

  • 相关阅读:
    612.1.004 ALGS4 | Elementary Sorts
    612.1.003 ALGS4 | Stacks and Queues
    612.1.002 ALGS4 | Analysis of Algorithms
    132.1.001 Union-Find | 并查集
    如何优雅使用Coursera ? —— Coursera 视频缓冲 & 字幕遮挡
    Jupyter notebook 使用多个Conda 环境
    如何从 GitHub 上下载单个文件夹
    在jupyter notebook中同时安装python2和python3
    修改ps工具栏字体大小
    python之集合
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4435728.html
Copyright © 2020-2023  润新知