>데이터 베이스 >MySQL 튜토리얼 >Oracle数据库删除语句DELETE的一般性用法

Oracle数据库删除语句DELETE的一般性用法

WBOY
WBOY원래의
2016-06-07 14:55:211857검색

语法与其它的sql数据库教程是一样的,如下 DELETE FROM COURSES WHERE COURSE_DESIGNATER = 'Java110' 按条件比较复杂的操作方法 DELETE FROM CLASSCONVENINGS WHERE CLASSES_NUM_FK 4 AND CLASS_CONVENE_DATE = TO_DATE('2006-02-15 00:00:00', 'YYYY-MM-

语法与其它的sql数据库教程是一样的,如下
DELETE FROM COURSES
WHERE  COURSE_DESIGNATER = 'Java110'

按条件比较复杂的操作方法

DELETE FROM CLASSCONVENINGS
WHERE      CLASSES_NUM_FK      > 4 
  AND CLASS_CONVENE_DATE = TO_DATE('2006-02-15 00:00:00',
                                   'YYYY-MM-DD HH24:MI:SS')
  AND CLASS_LOCATION_FK   = 'Seattle-Training Room 1'
 

下面来看个详细的实例

SQL> -- create demo table
SQL> create table Employee(
  2    ID                 VARCHAR2(4 BYTE)         NOT NULL,
  3    First_Name         VARCHAR2(10 BYTE),
  4    Last_Name          VARCHAR2(10 BYTE),
  5    Start_Date         DATE,
  6    End_Date           DATE,
  7    Salary             Number(8,2),
  8    City               VARCHAR2(10 BYTE),
  9    Description        VARCHAR2(15 BYTE)
 10  )
 11  /

Table created.

SQL>
SQL> -- prepare data
SQL> insert into Employee(ID,  First_Name, Last_Name, Start_Date,                     End_Date,                       Salary,  City,       Description)
  2               values ('01','Jason',    'Martin',  to_date('19960725','YYYYMMDD'), to_date('20060725','YYYYMMDD'), 1234.56, 'Toronto',  'Programmer')
  3  /

1 row created.

SQL> insert into Employee(ID,  First_Name, Last_Name, Start_Date,                     End_Date,                       Salary,  City,       Description)
  2                values('02','Alison',   'Mathews', to_date('19760321','YYYYMMDD'), to_date('19860221','YYYYMMDD'), 6661.78, 'Vancouver','Tester')
  3  /

1 row created.

SQL> insert into Employee(ID,  First_Name, Last_Name, Start_Date,                     End_Date,                       Salary,  City,       Description)
  2                values('03','James',    'Smith',   to_date('19781212','YYYYMMDD'), to_date('19900315','YYYYMMDD'), 6544.78, 'Vancouver','Tester')
  3  /

1 row created.

SQL> insert into Employee(ID,  First_Name, Last_Name, Start_Date,                     End_Date,                       Salary,  City,       Description)
  2                values('04','Celia',    'Rice',    to_date('19821024','YYYYMMDD'), to_date('19990421','YYYYMMDD'), 2344.78, 'Vancouver','Manager')
  3  /

1 row created.

SQL> insert into Employee(ID,  First_Name, Last_Name, Start_Date,                     End_Date,                       Salary,  City,       Description)

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.