Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

sql - 如何使用联接从表成分SQL中列出有关所购买表成分和成分名称的所有信息(How can I list all information about the table ingredients purchased and the ingredient's name from table ingredient SQL using a JOIN)

As you see in the picture below is the diagram,

(如下图所示,)

I need to create this query: List all information about ingredients purchased include the ingredient name, sorted by the date ordered.

(我需要创建此查询:列出有关购买的食材的所有信息,包括食材名称,按订购日期排序。)

Thanks

(谢谢)

The tables I have:

(我有的表:)

CREATE TABLE ingredient_purchase_list (

(创建表Ingredient_purchase_list()
ing_pl_id NUMBER(4,0) PRIMARY KEY, date_ordered DATE , quantity VARCHAR2(15), unit VARCHAR(15), unit_price NUMBER(4,2) NOT NULL, ingredient_id NUMBER(4,0),

(ing_pl_id NUMBER(4,0)主键,date_ordered DATE,数量VARCHAR2(15),单位VARCHAR(15),单价NUMBER(4,2)非空,Ingredient_id NUMBER(4,0),)
CONSTRAINT ingredient_id_fk FOREIGN KEY (ingredient_id) REFERENCES ingredient (ingredient_id));

(CONSTRAINT Ingredient_id_fk FOREIGN KEY(ingredient_id)参考成分(ingredient_id));)

  CREATE TABLE ingredient
(
 ingredient_id NUMBER(4,0) PRIMARY KEY,
 ingredient_name VARCHAR2(100) NOT NULL
);

在此处输入图片说明

  ask by Tiz translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...