zoukankan      html  css  js  c++  java
  • DDL语言的学习

    一、DDL语言的学习
       1.create关键字,用来创建表结构
        /*格式如下:
          create table tname(
          colName dataType,
          colName dataType,
          ………………
          colName dataType
          );
        */
      2:alter,用来修改表结构
         1)增加表的字段
          --格式: alter table tname add (colName dataType);
          --练习:为表temp_1增加个字段 tage 类型为number,长度为2
            alter table temp_1 add (tage number(2));
          2)删除表的字段
          -- 格式: alter table tname drop column colName
          -- 练习:删除temp_1表中的tage
            alter table temp_1 drop column tage;
         3)修改字段的名称
          -- 格式: alter table tname rename column oldName to newName
          -- 练习:将表temp_1的tname修改成name
          alter table temp_1 rename column tname to name;
         4)修改字段的数据类型
          -- 格式:alter table tname modify colName dataType
          -- 练习:修改temp_1表中的name 为varchar2(30);
          alter table temp_1 modify name varchar2(30);
        5)修改表名
          -- 格式:rename oldTname to newTname
          -- 练习:修改temp_1为temp_2;
          rename temp_1 to temp_2;
         6)删除表结构
          -- 格式:drop table tname;
          -- 练习:将temp_2删除
          drop table temp_2;
        7)查看表结构
        -- 格式: desc tname;
        -- 练习:创建temp_1,查看表结构
        desc temp_1;
     


  • 相关阅读:
    Max Sum of Max-K-sub-sequence(单调队列)
    Matrix Swapping II(求矩阵最大面积,dp)
    重温世界杯(贪心)
    Pie(求最小身高差,dp)
    Matrix(多线程dp)
    Python 实现自动导入缺失的库
    分布式系统session一致性解决方案
    数据结构 【链表】
    【数字图像处理】gamma变换
    【数字图像处理】顶帽变换和底帽变换
  • 原文地址:https://www.cnblogs.com/xiaozelulu/p/8835761.html
Copyright © 2011-2022 走看看