新闻动态

良好的口碑是企业发展的动力

insertselect语句

发布时间:2024-03-11 08:32:51 点击量:243
建网站

 

INSERT INTO table_name (column1

column2

column3)

VALUES (value1

value2

value3);

 

SELECT column1

column2

column3

FROM table_name;

 

INSERT INTO customer (customer_id

customer_name

email)

VALUES (1

'John Smith'

'john.smith@example.com');

 

SELECT customer_id

customer_name

email

FROM customer;

 

INSERT INTO order (order_id

customer_id

order_date)

VALUES (101

1

'2022-01-01');

 

SELECT order_id

customer_id

order_date

FROM order;

 

INSERT INTO product (product_id

product_name

price)

VALUES (1

'T-shirt'

20.00);

 

SELECT product_id

product_name

price

FROM product;

 

INSERT INTO order_details (order_id

product_id

quantity)

VALUES (101

1

2);

 

SELECT order_id

product_id

quantity

FROM order_details;

 

INSERT INTO employee (employee_id

employee_name

position)

VALUES (1

'Jane Doe'

'Manager');

 

SELECT employee_id

employee_name

position

FROM employee;

 

INSERT INTO department (department_id

department_name)

VALUES (1

'Sales');

 

SELECT department_id

department_name

FROM department;

 

INSERT INTO employee_department (employee_id

department_id)

VALUES (1

1);

 

SELECT employee_id

department_id

FROM employee_department;

 

INSERT INTO shipment (shipment_id

order_id

shipment_date)

VALUES (1

101

'2022-01-05');

 

SELECT shipment_id

order_id

shipment_date

FROM shipment;

 

INSERT INTO payment (payment_id

order_id

payment_date

amount)

VALUES (1

101

'2022-01-10'

40.00);

 

SELECT payment_id

order_id

payment_date

amount

FROM payment;

 

INSERT INTO feedback (feedback_id

order_id

rating

comments)

VALUES (1

101

5

'Great service!');

 

SELECT feedback_id

order_id

rating

comments

FROM feedback;

 

INSERT INTO review (review_id

product_id

rating

comments)

VALUES (1

1

4

'Good quality product.');

 

SELECT review_id

product_id

rating

comments

FROM review;

 

INSERT INTO supplier (supplier_id

supplier_name

contact)

VALUES (1

'ABC Company'

'123-456-7890');

 

SELECT supplier_id

supplier_name

contact

FROM supplier;

 

INSERT INTO product_supplier (product_id

supplier_id)

VALUES (1

1);

 

SELECT product_id

supplier_id

FROM product_supplier;

 

INSERT INTO warehouse (warehouse_id

location)

VALUES (1

'123 Main St.');

 

SELECT warehouse_id

location

FROM warehouse;

 

INSERT INTO inventory (product_id

warehouse_id

quantity)

VALUES (1

1

50);

 

SELECT product_id

warehouse_id

quantity

FROM inventory;

 

INSERT INTO promotion (promotion_id

promotion_name

discount)

VALUES (1

'Spring Sale'

10);

 

SELECT promotion_id

promotion_name

discount

FROM promotion;

 

INSERT INTO order_promotion (order_id

promotion_id)

VALUES (101

1);

 

SELECT order_id

promotion_id

FROM order_promotion;

 

INSERT INTO campaign (campaign_id

campaign_name

start_date

end_date)

VALUES (1

'Summer Campaign'

'2022-06-01'

'2022-08-31');

 

SELECT campaign_id

campaign_name

start_date

end_date

FROM campaign;

 

INSERT INTO campaign_product (campaign_id

product_id)

VALUES (1

1);

 

SELECT campaign_id

product_id

FROM campaign_product;

 

INSERT INTO event (event_id

event_name

location

date)

VALUES (1

'Holiday Party'

'ABC Club'

'2022-12-25');

 

SELECT event_id

event_name

location

date

FROM event;

 

INSERT INTO attendee (event_id

employee_id)

VALUES (1

1);

 

SELECT event_id

employee_id

FROM attendee;

 

INSERT INTO task (task_id

task_name

employee_id

due_date)

VALUES (1

'Monthly Report'

1

'2022-01-31');

 

SELECT task_id

task_name

employee_id

due_date

FROM task;

 

INSERT INTO reminder (reminder_id

task_id

reminder_date)

VALUES (1

1

'2022-01-30');

 

SELECT reminder_id

task_id

reminder_date

FROM reminder;

 

INSERT INTO notification (notification_id

employee_id

message

sent_date)

VALUES (1

1

'Meeting at 2pm'

'2022-01-15');

 

SELECT notification_id

employee_id

message

sent_date

FROM notification;

 

INSERT INTO survey (survey_id

survey_name

question1

question2

question3)

VALUES (1

'Customer Satisfaction'

'How satisfied are you with our service?'

'Would you recommend us to others?'

'Any suggestions for improvement?');

 

SELECT survey_id

survey_name

question1

question2

question3

FROM survey;

 

INSERT INTO response (response_id

survey_id

customer_id

answer1

answer2

answer3)

VALUES (1

1

1

'Very satisfied'

'Yes'

'Faster shipping');

 

SELECT response_id

survey_id

customer_id

answer1

answer2

answer3

FROM response;

 

INSERT INTO report (report_id

employee_id

report_date

notes)

VALUES (1

1

'2022-01-31'

'Sales exceeded target.');

 

SELECT report_id

employee_id

report_date

notes

FROM report;

 

INSERT INTO review_request (request_id

product_id

customer_id

request_date)

VALUES (1

1

1

'2022-01-20');

 

SELECT request_id

product_id

customer_id

request_date

FROM review_request;

 

INSERT INTO review_response (response_id

request_id

review_date

rating

comments)

VALUES (1

1

'2022-01-25'

4

'Thank you for your feedback.');

 

SELECT response_id

request_id

review_date

rating

comments

FROM review_response;

 

INSERT INTO recommendation (recommendation_id

product_id

recommended_product_id)

VALUES (1

1

2);

 

SELECT recommendation_id

product_id

recommended_product_id

FROM recommendation;

 

INSERT INTO wishlist (wishlist_id

customer_id

product_id)

VALUES (1

1

2);

 

SELECT wishlist_id

customer_id

product_id

FROM wishlist;

 

INSERT INTO comparison (comparison_id

product1_id

product2_id)

VALUES (1

1

2);

 

SELECT comparison_id

product1_id

product2_id

FROM comparison;

 

INSERT INTO feedback_response (response_id

feedback_id

response_date

response_comments)

VALUES (1

1

'2022-01-15'

'Thank you for your feedback.');

 

SELECT response_id

feedback_id

response_date

response_comments

FROM feedback_response;

 

INSERT INTO order_status (order_id

status)

VALUES (101

'Shipped');

 

SELECT order_id

status

FROM order_status;

 

INSERT INTO promotion_status (promotion_id

status)

VALUES (1

'Active');

 

SELECT promotion_id

status

FROM promotion_status;

 

INSERT INTO campaign_status (campaign_id

status)

VALUES (1

'Scheduled');

 

SELECT campaign_id

status

FROM campaign_status;

 

INSERT INTO event_status (event_id

status)

VALUES (1

'Confirmed');

 

SELECT event_id

status

FROM event_status;

 

INSERT INTO task_status (task_id

status)

VALUES (1

'Completed');

 

SELECT task_id

status

FROM task_status;

 

INSERT INTO reminder_status (reminder_id

status)

VALUES (1

'Pending');

 

SELECT reminder_id

status

FROM reminder_status;

 

INSERT INTO notification_status (notification_id

status)

VALUES (1

'Sent');

 

SELECT notification_id

status

FROM notification_status;

 

INSERT INTO survey_status (survey_id

status)

VALUES (1

'Open');

 

SELECT survey_id

status

FROM survey_status;

 

INSERT INTO response_status (response_id

status)

VALUES (1

'Submitted');

 

SELECT response_id

status

FROM response_status;

 

INSERT INTO report_status (report_id

status)

VALUES (1

'Finalized');

 

SELECT report_id

status

FROM report_status;

 

INSERT INTO review_request_status (request_id

status)

VALUES (1

'Open');

 

SELECT request_id

status

FROM review_request_status;

 

INSERT INTO review_response_status (response_id

status)

VALUES (1

'Reviewed');

 

SELECT response_id

status

FROM review_response_status;

 

INSERT INTO recommendation_status (recommendation_id

status)

VALUES (1

'Active');

 

SELECT recommendation_id

status

FROM recommendation_status;

 

INSERT INTO wishlist_status (wishlist_id

status)

VALUES (1

'Active');

 

SELECT wishlist_id

status

FROM wishlist_status;

 

INSERT INTO comparison_status (comparison_id

status)

VALUES (1

'Active');

 

SELECT comparison_id

status

FROM comparison_status;

 

INSERT INTO feedback_response_status (response_id

status)

VALUES (1

'Replied');

 

SELECT response_id

status

FROM feedback_response_status;

 

INSERT INTO order_status_history (order_id

status

status_date)

VALUES (101

'Shipped'

'2022-01-05');

 

SELECT order_id

status

status_date

FROM order_status_history;

 

INSERT INTO promotion_status_history (promotion_id

status

status_date)

VALUES (1

'Active'

'2022-01-01');

 

SELECT promotion_id

status

status_date

FROM promotion_status_history;

 

INSERT INTO campaign_status_history (campaign_id

status

status_date)

VALUES (1

'Scheduled'

'2022-01-01');

 

SELECT campaign_id

status

status_date

FROM campaign_status_history;

 

INSERT INTO event_status_history (event_id

status

status_date)

VALUES (1

'Confirmed'

'2022-01-01');

 

SELECT event_id

status

status_date

FROM event_status_history;

 

INSERT INTO task_status_history (task_id

status

status_date)

VALUES (1

'Completed'

'2022-01-31');

 

SELECT task_id

status

status_date

FROM task_status_history;

 

INSERT INTO reminder_status_history (reminder_id

status

status_date)

VALUES (1

'Pending'

'2022-01-30');

 

SELECT reminder_id

status

status_date

FROM reminder_status_history;

 

INSERT INTO notification_status_history (notification_id

status

status_date)

VALUES (1

'Sent'

'2022-01-15');

 

SELECT notification_id

status

status_date

FROM notification_status_history;

 

INSERT INTO survey_status_history (survey_id

status

status_date)

VALUES (1

'Open'

'2022-01-01');

 

SELECT survey_id

status

status_date

FROM survey_status_history;

 

INSERT INTO response_status_history (response_id

status

status_date)

VALUES (1

'Submitted'

'2022-01-20');

 

SELECT response_id

status

status_date

FROM response_status_history;

 

INSERT INTO report_status_history (report_id

status

status_date)

VALUES (1

'Finalized'

'2022-01-31');

 

SELECT report_id

status

status_date

FROM report_status_history;

 

INSERT INTO review_request_status_history (request_id

status

status_date)

VALUES (1

'Open'

'2022-01-20');

 

SELECT request_id

status

status_date

FROM review_request_status_history;

 

INSERT INTO review_response_status_history (response_id

status

status_date)

VALUES (1

'Reviewed'

'2022-01-25');

 

SELECT response_id

status

status_date

FROM review_response_status_history;

 

INSERT INTO recommendation_status_history (recommendation_id

status

status_date)

VALUES (1

'Active'

'2022-01-01');

 

SELECT recommendation_id

status

status_date

FROM recommendation_status_history;

 

INSERT INTO wishlist_status_history (wishlist_id

status

status_date)

VALUES (1

'Active'

'2022-01-01');

 

SELECT wishlist_id

status

status_date

FROM wishlist_status_history;

 

INSERT INTO comparison_status_history (comparison_id

status

status_date)

VALUES (1

'Active'

'2022-01-01');

 

SELECT comparison_id

status

status_date

FROM comparison_status_history;

 

INSERT INTO feedback_response_status_history (response_id

status

status_date)

VALUES (1

'Replied'

'2022-01-15');

 

SELECT response_id

status

status_date

FROM feedback_response_status_history;

 

This is an example of how to use the INSERT INTO and SELECT statements to add data to a database table and retrieve that data. By utilizing these statements effectively

you can manipulate and query data in your database to meet your specific needs. Remember to adjust the table names and column names to match your database schema and requirements.

免责声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,也不承认相关法律责任。如果您发现本社区中有涉嫌抄袭的内容,请发送邮件至:dm@cn86.cn进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。本站原创内容未经允许不得转载。
上一篇: idea安装lombok
下一篇: chirp信号