zoukankan      html  css  js  c++  java
  • 第一章 使用命令创建数据库和表

    --创建数据库
    create database StudentDB
    --使用数据库
    use StudentDB
    --使用系统数据库
    use master
    --删除数据库
    drop database StudentDB
    ---创建表
    create table Student
    (
    学号 int primary key identity(1000,1),
    姓名 varchar(50) not null,
    性别 char(2),
    出生日期 date,
    专业 varchar(50),
    总学分 int default 0,
    备注 varchar(500),
    )
    --插入数据
    insert into Student(姓名,性别,出生日期,专业,备注)values ('张三','','1990-1-25','计算机','null')
    insert into Student(姓名,性别,出生日期,专业,备注)values('李四','','1991-01-25','计算机','null')
    insert into Student(姓名,性别,出生日期,专业,备注)values('王五','','1992-01-25','软件工程','c++考试不及格')
    --查询数据
    select*from Student
    --修改数据
    update Student set 姓名='赵六',备注='c++考试及格', 学号=1000
    update Student set 姓名='王五', 出生日期= '1995-02-3' where 学号=1002
    --删除数据
    delete from Student where 学号=1001
    delete from Student where 姓名='王五'
    
     
  • 相关阅读:
    Qt状态机实例
    <STL> accumulate 与 自定义数据类型
    <STL> 容器混合使用
    散列表(C版)
    Canonical 要将 Qt 应用带入 Ubuntu
    <STL> set随笔
    C++ 文件流
    视频播放的基本原理
    <STL> pair随笔
    c++ 内存存储 解决char*p, char p[]的问题
  • 原文地址:https://www.cnblogs.com/zhang1997/p/7840010.html
Copyright © 2011-2022 走看看