How to create a table and import data in Oracle?
To create a table and import data in Oracle, you can follow the steps below:
- Create a table using the CREATE TABLE statement. For example, create a table named “employees” with three columns: “emp_id” (employee ID), “emp_name” (employee name), and “emp_salary” (employee salary).
CREATE TABLE employees (
emp_id NUMBER,
emp_name VARCHAR(50),
emp_salary NUMBER
);
- Use the INSERT INTO statement to insert data into a table. For example, insert the following data into the “employees” table.
INSERT INTO employees (emp_id, emp_name, emp_salary)
VALUES (1, 'John Smith', 5000);
INSERT INTO employees (emp_id, emp_name, emp_salary)
VALUES (2, 'Jane Doe', 6000);
Multiple data entries can be inserted as needed.
- Verify data insertion using the SELECT statement. For example, execute the following SELECT statement to query all data in the “employees” table:
SELECT * FROM employees;
Display all information of employees.
Please note that before carrying out the above operations, you must be connected to an Oracle database and have the appropriate permissions to create tables and insert data.