zoukankan      html  css  js  c++  java
  • SQL语句之DDL语句

    一、DML语句简介

      ·DML(data definition language) 数据操作语句,包括create,drop,alter

    二、create

      1.创建数据库:语法 create database 库名

      2.创建表:语法:crate table 表名

      3.创建索引:

        (1)创建普通索引:语法:create index 索引名  on  表名(列名)

        (2)创建唯一索引:语法:create unique index 索引名 on 表名(列名)

    三、alter

      1.为表增加列 语法:alter table 表名  add 列名(也可指定字符长度)

      2.删除表中的某一列 语法: alter table 表名 drop 列名

      3.修改列的字符长度或类型或重命名类名  语法:alter table 表名  change  原来的列   新的列  新的字符长度

      4.修改表名  语法;alter table 表名 rename 新表名

      5.删除表中主键 语法:alter table 表名 drop primary key

      6.为表添加主键 语法:alter  table  表名  add  constraint 主键名  primary key(列名)

      7.添加索引:alter table 表名 add index 索引名(列名)

      8.添加唯一索引 语法;alter table 表名 add  unique  index  索引名(列)

           9.删除索引语法;alter table 表名 drop index  索引名

      10.修改字段数据类型 alter table 表名 modify  字段  数据类型

    四、drop 

      1.删除表 语法:drop table 表名

      2.删除库名 语法:drop database 库名

  • 相关阅读:
    eclipse 插件编写(三)(转)
    eclipse 插件编写(二)
    eclipse 插件编写(一)(转)
    js 中的 this 关键字
    js中创建对象的几种方式
    js 如何中如何理解对象?
    项目中的小技巧
    王国维的诗
    uni-app 基础组件
    登庐山 毛
  • 原文地址:https://www.cnblogs.com/shi-san/p/13455365.html
Copyright © 2011-2022 走看看