• 创建表,插入列....


    --创建表
    create table worth(
                       evday varchar2(52),
                       weather varchar2(10),
                       temperature number(10))
    select * from worth;
    --插入行内容
    insert into worth (evday,weather, temperature)
    values (to_char(sysdate,'yyyy/mm/dd'),'阴天',30);
    insert into worth (evday,weather,temperature)
    values (to_char(sysdate+1,'yyyy/mm/dd') ,'雨天',20);
    insert into worth (evday,weather,temperature)
    values  (to_char(sysdate+2,'yyyy/mm/dd') ,'雨天',22);
    insert into worth (evday,weather,temperature)
    values  (to_char(sysdate+3,'yyyy/mm/dd') ,'阴转小雨天',25);
    insert into worth (evday,weather,temperature)
    values  (to_char(sysdate+4,'yyyy/mm/dd') ,'大雨',22);
    insert into worth (evday,weather,temperature)
    values  (to_char(sysdate+5,'yyyy/mm/dd') ,'大雨转阴天',22);
    --增加列
    alter  table worth 
    add (出行方式 varchar(20),晨练指数 number(10));
    alter table worth 
    add (心情 char(20),旅游 char );
    --删除列 一定要column 
    alter table  worth drop
    COLUMN 旅游;
    alter table  worth drop
    COLUMN 心情;
    alter table worth 
    drop column 出行方式;
    
    --drop table worth;
    select to_char(sysdate,'yyyy-mm-dd') from dual;
    delete worth;
    --重命名表名
    rename worth to werther_day;
    select * from werther_day;
    rename werther_day to weath;
    rename weath to worth;
    insert into worth (晨练指数 , 心情)
    values ( 5 ,'good')
    where temperature= 22
    update  worth
    set 晨练指数 = 3,心情='good'
    where evday = '2017/07/17';
    update  worth
    set 晨练指数 = 5,心情='wonderful'
    where evday = '2017/07/18';
    update  worth
    set 晨练指数 = 6,心情='beautiful'
    where evday = '2017/07/19';
    update worth
    set  晨练指数 = 6,心情='beauty and wonder'
    where evday = '2017/07/20';
    delete worth
    where evday = '2017/07/21';
  • 相关阅读:
    对我影响最大的老师
    秋季学习总结
    介绍自己
    搭建新环境的准备工作
    我的技术博客开通啦!!
    java数组及数组的插入,删除,冒泡算法
    包(package)以及面向对象三个基本特征(继承)的介绍
    常用的Arrays类和二维数组以及二分法的介绍
    构造方法、封装、关键字(this、static)和代码块的介绍
    类和对象的介绍
  • 原文地址:https://www.cnblogs.com/fy02223y/p/7202096.html
Copyright © 2020-2023  润新知