Sqlplus로 테이블 만들기

인삼주·2023년 4월 21일
0

C:\Users\PC-19>sqlplus sys/java@127.0.0.1:1521 as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 금 4월 21 09:26:19 2023

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


다음에 접속됨:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> CREATE TABLE Iprodd
  2  Iprodd_id number(5) NOT NULL,
  3  Iprodd_gu char(4) NOT NULL,
  4  Iprodd_nm varchar2(40) NOT NULL,
  5  Constraint pk_Iprodd Primary Key(Iprodd_gu)
  6  );
Iprodd_id number(5) NOT NULL,
*
2행에 오류:
ORA-00922: missing or invalid option


SQL> CREATE TABLE Iprodd
  2  (Iprodd_id number(5) NOT NULL,
  3  Iprodd_gu char(4) NOT NULL,
  4  Iprodd_nm varchar2(40) NOT NULL,
  5  Constraint pk_Iprodd Primary Key(Iprodd_gu)
  6  ;

*
6행에 오류:
ORA-00907: missing right parenthesis


SQL> CREATE TABLE Iprodd
  2  (
  3  Iprodd_id number(5) NOT NULL,
  4  Iprodd_gu char(4) NOT NULL,
  5  Iprodd_nm varchar2(40) NOT NULL,
  6  Constraint pk_Iprodd Primary Key(Iprodd_gu)
  7  );

테이블이 생성되었습니다.

SQL> INSERT INTO Iprodd(Iprodd_o id, Iprodd gu,Iprod_nm
  2  *DEL
  3  DEL 1
  4  INSERT INTO Iprodd(Iprodd_id, Iprodd_gu, Iprodd_nm)
  5  VALUES(1,'P101','컴퓨터제품');
INSERT INTO Iprodd(Iprodd_o id, Iprodd gu,Iprod_nm
                            *
1행에 오류:
ORA-00917: missing comma


SQL> DEL 1
SQL> INSERT INTO Iprodd(Iprodd_id, Iprodd_gu, Iprodd_nm)
  2  VALUES(1,'P101','컴퓨터제품');

1 개의 행이 만들어졌습니다.

SQL> INSERT INTO Iprodd(Iprodd_id, Iprodd_gu, Iprodd_nm)
  2  VALUES(2,'P102','전자제품');

1 개의 행이 만들어졌습니다.

SQL> SELECT Iprodd
  2  FROM Iprodd
  3  ;
SELECT Iprodd
       *
1행에 오류:
ORA-00904: "IPRODD": invalid identifier


SQL> SELECT Iprodd_id
  2  FROM Iprodd ;

 IPRODD_ID
----------
         1
         2

SQL> SELECT Iprodd_nm
  2  FROM Iprodd;

IPRODD_NM
--------------------------------------------------------------------------------
컴퓨터제품
전자제품

SQL>```

0개의 댓글