Create the following table in your database with the following schema: Table: salesPerson | Column Name 1 Туре | sales_id | name | salary | commission_rate | int | hire_date | int | varchar | | int | date +--- sales_id is the primary key column for this table. Each row of this table indicates the name and the ID of a salesperson alongside their salary, commission rate, and hire date. CO Table: Company | Column Name | Type | int | varchar | | varchar | | com_id I name | city +-- ----+ com_id is the primary key column for this table. Each row of this table indicates the name and the ID of a company and the city in which the company is located. Table: Orders | Column Name | Type I | order_id I order date I com_id | sales_id | int | date | | int | int | int | amount +-- +------+ order_id is the primary key column for this table. com_id is a foreign key to com_id from the Company table. sales_id is a foreign key to com_id from the SalesPerson table. Each row of this table contains information about one order. This includes the ID of the company, the ID of the salesperson, the date of the order, and the amount paid. Add the following data to your tables:
SQL
SQL stands for Structured Query Language, is a form of communication that uses queries structured in a specific format to store, manage & retrieve data from a relational database.
Queries
A query is a type of computer programming language that is used to retrieve data from a database. Databases are useful in a variety of ways. They enable the retrieval of records or parts of records, as well as the performance of various calculations prior to displaying the results. A search query is one type of query that many people perform several times per day. A search query is executed every time you use a search engine to find something. When you press the Enter key, the keywords are sent to the search engine, where they are processed by an algorithm that retrieves related results from the search index. Your query's results are displayed on a search engine results page, or SER.
Create the tables in sql code of the attached question ?
CREATE TABLE table_name
(
column1 data type;
column2 data type;
column3 date type;
...
);
Note: For keeping sales_id in orders as the foreign key of com_id in sales_person it is not possible because com_id column is not there in slaes order table it should be sales_Id
For keeping column as primary key we declare primary after column data type
For foreign key we should use FOREIGN KEY (table_name) REFERENCES other_table_name(other_table_column)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps