我有兩個表:如何創建一個查詢來計算外鍵在另一個表中使用的次數?
CREATE TABLE "OEHR_COUNTRIES" (
"COUNTRY_ID" CHAR(2) CONSTRAINT "OEHR_COUNTRY_ID_NN" NOT NULL ENABLE,
"COUNTRY_NAME" VARCHAR2(40),
"REGION_ID" NUMBER,
CONSTRAINT "OEHR_COUNTRY_C_ID_PK" PRIMARY KEY ("COUNTRY_ID") ENABLE
)/
CREATE TABLE "OEHR_LOCATIONS" (
"LOCATION_ID" NUMBER(4,0),
"STREET_ADDRESS" VARCHAR2(40),
"POSTAL_CODE" VARCHAR2(12),
"CITY" VARCHAR2(30) CONSTRAINT "OEHR_LOC_CITY_NN" NOT NULL ENABLE,
"STATE_PROVINCE" VARCHAR2(25),
"COUNTRY_ID" CHAR(2),
CONSTRAINT "OEHR_LOC_ID_PK" PRIMARY KEY ("LOCATION_ID") ENABLE
)
/
,我需要創建顯示與的每個位置都有數一起的名稱和每一個國家的ID查詢。
OK,你有什麼企圖? – OldProgrammer
@ EJG101 - 請不要無故破壞帖子。 – GurV