CREATE TABLE
To create a table named "sales" with columns for "month", "year", "sales", and "region" in Oracle SQL, you can use the following SQL query:
CREATE TABLE sales (
month VARCHAR(10),
year NUMBER(4),
sales NUMBER(10,2),
region VARCHAR(50)
);
This query will create a table with four columns: "month", "year", "sales", and "region". The "month" column is defined as a VARCHAR with a maximum length of 10 characters, "year" is defined as a NUMBER with a maximum of 4 digits, "sales" is defined as a NUMBER with a maximum of 10 digits and 2 decimal places, and "region" is defined as a VARCHAR with a maximum length of 50 characters. You can adjust the data types and column lengths based on your specific needs.
INSERT TABLE
To insert data into the "sales" table that we just created, you can use the following SQL query as an example:
INSERT INTO sales (month, year, sales, region)
VALUES ('January', 2023, 50000.00, 'North America');
This query will insert a single row of data into the "sales" table. The values 'January', 2023, 50000.00, and 'North America' will be inserted into the columns for "month", "year", "sales", and "region", respectively.
If you want to insert multiple rows at once, you can use a query like this:
INSERT INTO sales (month, year, sales, region)
VALUES
('January', 2023, 50000.00, 'North America'),
('February', 2023, 60000.00, 'Europe'),
('March', 2023, 70000.00, 'Asia');
This query will insert three rows of data into the "sales" table, with each row containing values for "month", "year", "sales", and "region".
RESULT
SELECT * FROM sales;