How do you create tables in Oracle
Introduction to ORACLE
Application for a user IDThe prerequisite for using ORACLE is a UNIX ID for the computer center of the Trier University of Applied Sciences. You apply for an ORACLE user ID with Prof. Dr. Klösener or Prof. Dr. Capricorn.
Register with ORACLEBy logging in with your UNIX ID from the data center, you open a session on the Trier University of Applied Sciences' database computer.
You log in to ORACLE with (if you have not been explicitly assigned a password):
You will then receive the prompt:SQL>
Log out of ORACLETo exit sqlplus enter SQL> exit; a.
Create a tableYou can execute any SQL command in. To create a table, enter the following command: CREATE TABLE
- ); You can enter them in one or more lines. If your command extends over several lines, after pressing the Enter key you will receive the next line number as a prompt until you complete the command with a semicolon.
- L (completely lists the command in the buffer).
- L n (only reproduces line n of the command; also makes this line the current Line - recognizable by the preceding *). (Instead of L n, it is also sufficient to enter n alone)
- L n , m (reproduces line n through line m).
- I (gives you a new input line following the current line; the lines that previously followed the current line are appended afterwards). You end your entry by pressing the button twice.
- C / old / new (replaces the first Occurrence of the character string 'old' through 'new' in the current line). (Contains 'old' or 'new' but e.g. the slash / you should use the form C.old.new.)
- A text (appends 'text' to the end of the current line).
- DEL (deletes the current line).
- n text (replaces line n with 'text'; 0 text inserts a line with 'text' before the previous line 1)
- (Line 1): LOAD DATA is always at the beginning of an SQL * LOADER control file
- (Line 2): INFILE
indicates that the data records are in a file called file name
- (Line 3): INTO TABLE means that the data records are to be inserted into the existing (but empty) table. (If the new rows are to be added to the rows that already exist in the table, the clause must be APPEND INTO TABLE.)
- (Line 4): FIELDS TERMINATED BY ',' means that the fields in the file
are separated by commas.
- (Line 5): Here the input fields are assigned to the table fields taking into account the order. The DATE "dd-mm-yyyy" clause specifies the format in which dates are in
- What recipe makes the best fried clams
- Is Trump a man of his time
- Consider tipping Whole Foods Delivery
- Why is Goa's culture unique
- How does nutrition affect physical fitness?
- What does vegan makeup mean
- Can I overpay my mortgage every month?
- What is the value of sin 49
- Why is TechCrunch so popular
- Heard lizards make good pets
- What does inland fishing mean
- What's the best site for SEO
- Who won the battle of Cape Spartivento
- How many bands are required in IELTS
- The atomic number of the element is 74
- How can we ridicule AWS services
- What distinguishes mutation from normal genetic variation
- What are AI agents
- How are the largest heads formed?
- Affirmations can be created without the use of language
- Why don't birds chirp in the afternoon
- Can use Python
- What is echo time
- What is the future of Minneapolis
- What is euro short for?
- Is Pakistan a program country or not
- What is progressive supranuclear paralysis 1
- Where can I download free sanitary textbooks
- Should we download binaural beats from YouTube
- How Can Ecommerce Sellers Improve ROI?
- Hillary Clinton believes in God
- Are VPN and IPSec similar
- Why is Wireshark useful
Danger: An empty line ends the command but does not execute it. In this case you can use
SQL> r [or SQL> run] [or SQL> /]
the SQL command can be executed; With
SQL> l [or SQL> list]
the last entered SQL command is displayed again.
An example table is created with:create table student (matriculation number (6), name char (20), first name varchar2 (30), date_of_enrollment date); Note that SQL commands case insensitive are, then means the same as. This command creates a table with names and four attributes. The first is the integer, which consists of a maximum of six digits. Then comes with 20 alphanumeric characters (if less than 20 characters are assigned to this field, it is padded right-justified to twenty places with blanks). The can contain a maximum of 30 characters; However, only the characters entered are saved here. (This has the data type date, which only allows dates that are valid in the calendar.
Deleting tablesA table is deleted with: DROP TABLE
DROP TABLE student;
Inserting sentencesRecords can be inserted into an existing table with INSERT INTO
- ) VALUES (
- ); For example, the tuple (123456, 'McKinnock', 'Hugo', '01-OCT-97') can be inserted into the table by: INSERT INTO student (matriculation no, first name, name, date of enrollment) VALUES (123456, 'Hugo' , 'McKinnock', '01-OCT-97'); Character values (and dates) must be enclosed in single quotation marks, numeric values do not. The values within the quotation marks differ from the SQL commands case-sensitive !
Note: The order of surname and first name were reversed (compared to the create of the table); Of course, this only makes sense if the order of the attribute values in the list is behind the same. Entering is shorter and more convenient if you leave the list behind the table name. However, the order of this list is then used as it was entered in the create table statement; however, if the database administrator has planned a different sequence when restoring a data backup, scrap data may accumulate during the insert.INSERT INTO student VALUES (123456, 'Hugo', 'McKinnock', '01-OCT-97'); is allowed, but causes the insertion of a person with the surname 'Hugo' and the first name 'McKinnock'. You should only use this form of input if you are absolutely certain that the order has not changed. (Using this form in programs with embedded SQL commands is therefore grossly negligent.)
View information from tablesThe tuples that are stored in a relation can be viewed with: SELECT * FROM
Information about your databaseORACLE provides you with tables that provide you with information about your database. To find out all tables (and other objects) that have been created in your user ID, you can enter: SELECT TABLE_NAME FROM USER_TABLES; An older form of this query (which was already available before ORACLE8) is: SELECT * FROM tab; However, not only the tables are displayed here, but also VIEWS, SYNONYME .. (for these database objects there are meanwhile the relations USER_VIEWS, USER_SYNONYMS ...), which can be recognized by the attribute TABTYPE.
You can determine the structure of a table (i.e. name of the attributes, data type and the fact whether there is a requirement to enter values in this field -NOT NULL in contrast to the default setting NULL) by:SQL> DESC