zoukankan      html  css  js  c++  java
  • PHP数据表 T-SQL语句

     1 1.创建表
     2 create table Car
     3 (
     4     Code varchar(50) primary key ,
     5     Name varchar(50) not null,
     6     Time date,
     7     Price float,
     8     Brand varchar(50) references Brand(Code)
     9 );
    10 create table Brand
    11 (
    12     Code varchar(50) primary key,
    13     Name varchar(50)
    14 );
    15 
    16 
    17 create table PinPai
    18 (
    19     Ids int auto_increment primary key,
    20     Name varchar(50)
    21 );
    22 
    23 primary key 主键
    24 not null 非空
    25 references 引用
    26 auto_increment 自增长
    27 
    28 注意:所有符号必须是英文状态下的
    29     每个表创建完之后加分号
    30     表里面的最后一列写完之后不要加逗号
    31 
    32 删除表:
    33 drop table PinPai  
    34 
    35 数据的操作:CRUD操作
    36 
    37 1.添加数据:
    38 insert into Brand values('b001','宝马5'); #第一种方式
    39 insert into Brand (Code) values('b002');#第二种方式
    40 
    41 insert into PinPai values('','大众'); #处理自增长列
    42 
    43 2.最简单查询
    44 select * from PinPai  #查询所有数据
    45 select * from PinPai where Ids = 1;#根据条件查询
    46 
    47 3.修改数据
    48 
    49 update PinPai set Name = '大众' where Ids = 4; #修改某一条数据
    50 
    51 update Car set Name='哈弗',Time='2012-3-4',Price=16,Brand='b002' where Code='c001'
    52 
    53 4.删除数据
    54 
    55 delete from Brand #删除所有数据
    56 delete from PinPai where Ids = 4; #根据条件删除数据
  • 相关阅读:
    [Oracle11g]安装提示不能使用/usr/bin/xdpyinfo命令
    [shell]时间判断
    Share 简易网盘
    VSCODE代码上下对齐插件 — Better Align
    关于 vscode intelephense 错误提示的问题
    2021/11/08 集训补题
    [国家集训队]墨墨的等式
    马大师的分块练习
    20211109 集训补题
    弱智的 线性代数 学习笔记
  • 原文地址:https://www.cnblogs.com/as1234as/p/5265616.html
Copyright © 2011-2022 走看看