using a join of multiple tables to create queries
Hello...I don't have a lot of work on the oracle...
I have to create the query of tables...
_ Of the STUDENT
SNO (pk)
SNAME
deptId (FK)
EVENT_
eventId (PK)
eventName
deptId (FK)
_ DEPT
deptId (pk)
deptName
now I need list of students with events that can they participate...
as
sName event
Tech John
John headstart
Pls answer me...
Thanks in advance...
Select sname, eventname
Student event
where student.deptid = event.deptid
Tags: Database
Similar Questions
-
Update using several terms from multiple tables
Hello
I'm quite new to PL/SQL.
I need to update a record in a table with several conditions in which the clause of several tables.
On the internet I found something like
Update < table >
Set < column > = < value >
< Table >
Join them < table >
on < condition >
Where < condition >
And < another condition >
Now, I have:
Update outbound_order
Set outbound_order_sorting_code = "A".
to orderref o, oo outbound_order
where oo.ordernumber = o.ordernumber
and o.delivery_status = 'c ';
It gives ORA00933 of Pl/SQL to->
I can't use more than one table in update?
Kind regards
Chi Waiupdate outbound_order o set outbound_order_sorting_code = 'A' where exists(select 1 from orderref oo where oo.ordernumber = o.ordernumber) and delivery_status = 'c';
-
How to create a block of data to multiple tables
If I try to use the wizard to create a new block of data and I choose to create it on a table or a view, the wizard asks me for the table create the form on. But if I want to create a form with two tables for example to join them, how can I do? Do I have to create a view on the database (very bad for me!) before joining the wtho tables can create the form to this point of view, or is it possible to create a form in two or more tables?Mark,
Yes, you can base in fact of a block of shapes on a join of tables. Take a look at forms: how to build a block of data to a join of the table. You can also use a base query Clause From block. Basically, you base your block on a SQL statement. For more information on this option, take a look at forms: how to base a block on a FROM Clause query. Finally, you can also base your block on a procedure. This concept is illustrated in this article: forms: how a block of data based on a procedure.The fall down using one of these options, is that your block is not editable. If you need to update the data presented by these options, you should use the-Insert, triggers we set to and delete now write your own Insert/Update and Delete statements.
Hope this helps,
Craig B-)If someone useful or appropriate, please mark accordingly.
-
To create an interactive report in the apex by selecting from multiple tables
Hi, I am creating an interactive report by selecting from multiple tables.
SELECT w.FIRST_NAME as name, w.SURNAME as name, i.ROAD Road, i.DATE_OF_INC as DATE_OF_INC, S.STATEMENT as a STATEMENT OF Declaration
JOIN THE
WITNESS w
ON w.witness_id = s.FK1_WITNESS_ID
JOIN THE
Incident I have
WE
i.incident_no = w.FK1_INCIDENT_NO
JOIN THE
user_station ps
ON ps.station_id = i.nearest_station_id
JOIN THE
the user in.
WE
in. STATION_ID = ps.station_id
WHERE po.officer_id = 1
by I continue to encounter this error "the report query requires a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column. "ORA-01445: cannot select ROWID from where sample, a join without key preserved table view '
So I googled around and found that in the attibutres tables report, I need to change the "LINK" COLUMN so first, I changed "Link to custom target", but the report is so I changed it to "Exclude link Clolumn" again, the report didn't report and I STILL got a blank page with only the tabs.
I wonder you can not create a report by selecting from multiple tables?
If you can please I need your help.
Thank you
You can, but in this case, it might be easier to build your report tables that are joined Oracle views and then build your report out of the newly built sight...
Or wrap a selection around your selection with joins, and then make the where clause on the external selection...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILL -
need a script to create multiple tables as the other columns in tables
I need script to create multiple tables as the other columns of tables respectively.
lets consider I want to create tables from table1... table99 like tablex1... .tablex99 columns (without data) respectively (i.e table1 as tablex1, table99 as tablex99).declare cursor c is select object_name from all_objects where object_type='TABLE'; begin for i in c loop execute immediate 'create table '||i.object_name||'_x as select * from '||i.object_name||' where 1=2'; end loop; end; use can use this and put your user names accordingly. If you get any error please post the error.
-
Use with need to collect in bulk to insert records from multiple tables
Hello
I plsql record type with several tables with multiple columns. so when I used bulk collect with education for ALL. I want to insert records in multiple tables.
Please give me suggestions.
ForAll is designed to be used with a single DML statement, which may include dynamic SQL statements. However, I do not know what advantage this will give you your list iteration save several times, one for each table - especially since there is an air show with SQL dynamic.
Example 1 (dynamic SQL):
begin
...
forall i in vRecList.First..vRecList.Last
execute immediate '
begin
insert into Table1 (Col1, Col2, Col3) values (:1, :2, :3);
insert into Table2 (Col1, Col2, Col3) values (:1, :2, :3);
end;' using vRecList(i).Col1, vRecList(i).Col2, vRecList(i).Col3;
end;Another approach that I should work (but not tested) is using to insert all the Scriptures and based record inserts, but you need to try on your version of Oracle forall has changed between the versions. In this case vRecList must be compatible with the Table % ROWTYPE and Table2% ROWTYPE type.
Example 2 (insert all):
begin
...
forall i in vRecList.First..vRecList.Last
insert all
into Table1 values vRecList(i)
into Table2 values vRecList(i)
select 1 from dual;
end; -
ODI 11 g multiple table with union join
Hi all
I have a problem with joining 4 different tables and union all of them.
Here I want to generate this query;
Select * from
Table1, table2
Join table2 = table1
Union of all the
Select * from
Table 3, table 4
Join table3 = table 4
But I have not the same column that all the table, some are missing. When I write one - PL/SQL query I can easily add a false "NULL column1' column, but I can not how I do with ODI 11 g.
I tried not to use "Active Mapping", but it does not work.
I'm newbie ODI 11 g
Thank you
Myra
Hi, Myra,.
I'd even as in PL/SQL. In your table target add all the columns you need and overall data whatever you're missing some columns just put NULL in the mapping.
Thank you
Ajay
-
Please how can I use a value in a table of the adf in an actionListener to a button I created in a popup and thanks
What is your version of JDev?
Actually your question is not clear to me, but as I understand, it is you the table in the page and you have popup inside this popup you have the button you need when you click on the button to read the value of the selected table row. In the listener action button, so if you can get the current row of the table and after that you can get any attribute of the line as:
DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("TableIteratorName"); // from pageDef. Row r = iter.getCurrentRow(); Object value1 = r.getAttribute("attribute1"); Object value2 = r.getAttribute("attribute2");
-
How to load multiple files into multiple tables using a Controlfile?
Hello world
I have four different tables with similar structures, get the data from four different data files. I would like to use one control file to load the data from four different files from four different tables.
Here's the DOF of the tables:
CREATE TABLE Product_Sales( Year_of_Sale NUMBER, Product_Type VARCHAR2(25 CHAR), Product_Group VARCHAR2(25 CHAR), Category_Type VARCHAR2(25 CHAR), Category_Group VARCHAR2(10 CHAR), Product_Count NUMBER, Product_Amount NUMBER(19,2), Category_Count NUMBER, Category_Amount NUMBER(19,2) )
CREATE TABLE Retail_Sales( Year_of_Sale NUMBER, Product_Type VARCHAR2(25 CHAR), Product_Group VARCHAR2(25 CHAR), Category_Type VARCHAR2(25 CHAR), Category_Group VARCHAR2(10 CHAR), Product_Count NUMBER, Product_Amount NUMBER(19,2), Category_Count NUMBER, Category_Amount NUMBER(19,2) )
-
using two sum() in multiple join query
Hello
I'm stuck with the help of two sum() functions in a single query. Are columns of different tables that are joined.
table of charging
Date pay_amt cust_id
1 July 13 500 1
1 July 13 200 1
amount of usage
Date usg_amt cust_id
1 July 13 100 1
2 July 13 300 2
I want a single query to give me sum (pay_amt) and sum (usg_amt) for a client in a single day
That is to say:
o/p should be:
cust_id date sum (pay_amt) sum (usg_amt)
1 01 - Jul 700 100
My query is like below. But it gives incorrect total for both. Could someone tell me why?
Select sum (pay_amt), sum (usg_amt)
from charging r
join in-house use u
On u.cust_id = r.ID_client
and you.date = r.date
where u.cust_id = 1
and you.date = 1 July 13 '
chris227 wrote:
I seem to be a bug to me.
The result is 11.2.0.3
SUM(PAY_AMT) SUM(USG_AMT) 700 200 What is your version?
What looks like the plan to explain it with predicates?
BTW, why do you think that both are incorrect, for me, only the second is incorrect, should be 200 instead of 100.
Post edited by: chris227 Question added
No Chris, the po said they want the o/p 100, and they were getting an invalid value (for example, the 200 is incorrect).
It's because of the joining of the usg_amt of duplication:
SQL > ed
A written file afiedt.buf1 refill as (select date "'2013-07-01 as dt, 500 as pay_amt, 1 as cust_id of union double all the")
2 select dates "2013-07-01', 200, 1 double)
3, use as (select date "'2013-07-01 as dt, 100 in usg_amt, 1 as cust_id of union double all the")
4 Select the dates "2013-07-02', 300, 2 double)
5 --
6 select DT, pay_amt, usg_amt - sum (pay_amt), r.id_client, sum (usg_amt)
7 recharge r
8 join use u on u.cust_id = r.ID_client
9 and you.dt = DT
10 where u.cust_id = 1
11 * and u.dt = date ' 01-07-2013'
SQL > /.CUST_ID DT PAY_AMT USG_AMT
---------- -------------------- ---------- ----------
1 1 JULY 2013 00:00:00 200 100
1 1 JULY 2013 00:00:00 500 100If the sum is of course to sum up 100 twice because of two lines to pay.
So why I have indicated that the aggregation (sum) should usually before the join is made, so it is only made the cust_id amount and date for each table and then joined the results.
-
Multiple Table join without loss of data - SQL help
Hello
I have the following tables 3 employee as indicated in the scripts below, please help in writing SQL that connects all these 3 tables and displays the output as shown below
Required output
EMP ID Loc Value 1 Value 2 Value 3
1 A 3 1 6
1 B 4 9 null
Value null null 1 Wh 8
2 Z 4 9 null
3 R 0 null 1
4 Y 1 null null
5 O 7 7 null
Value null null 5 Wh 5
6 M 7 null 7
6 B null null 8
/ * Create Tables * /.
Create table Emp1 (Empid number, Loc Varchar2 (10), Value_1 number);
Create the Emp2 Table (Empid number, Loc Varchar2 (10), Value_2 number);
Create table emp3 (empid number, loc varchar2 (10), Value_3);
/ * Insert Scripts * /.
Insert Into Emp1 Values (1, 'A', 3);
Insert Into Emp1 Values (2, 'Z', 4);
Insert Into Emp1 Values (3, 'R', 0);
Insert Into Emp1 Values (4, 'Y', 1);
Insert Into Emp1 Values (5, 'o', 7);
Insert Into Emp1 Values (6, am', 7);
Insert Into Emp2 Values (1, 'A', 1);
Insert Into Emp2 Values (1, 'B', 4);
Insert Into Emp2 Values (1, 'Wh', 8);
Insert Into Emp2 Values (2, 'Z', 9);
Insert Into Emp2 Values (5, 'o', 7);
Insert Into Emp2 Values (5, 'Wh', 5);
Insert Into Emp3 Values (1, 'A', 6);
Insert Into Emp3 Values (1, 'B', 9);
Insert Into Emp3 Values (3, 'R', 1);
Insert Into Emp3 Values (6, am', 7);
Insert Into Emp3 Values (6, 'B', 8);
Commit;
Thank you
VarunLike this?
SQL> select nvl(e.empid, e3.empid) empid 2 , nvl(e.loc, e3.loc) loc 3 , e.value_1 4 , e.value_2 5 , e3.value_3 6 from ( 7 select nvl(e1.empid, e2.empid) empid 8 , nvl(e1.loc, e2.loc) loc 9 , e1.value_1 10 , e2.value_2 11 from emp1 e1 12 full join emp2 e2 13 on e1.empid = e2.empid 14 and e1.loc = e2.loc 15 ) e 16 full join emp3 e3 17 on e.empid = e3.empid 18 and e.loc = e3.loc 19 order 20 by empid 21 , loc 22 / EMPID LOC VALUE_1 VALUE_2 VALUE_3 ---------- ---------- ---------- ---------- ---------- 1 A 3 1 6 1 B 4 9 1 Wh 8 2 Z 4 9 3 R 0 1 4 Y 1 5 O 7 7 5 Wh 5 6 B 8 6 M 7 7 10 rows selected. SQL>
-
created by using the default tablespace "SYSAUX' table
Hi all
I am a newbie of semantic technology from oracle. I have a question that I do not understand why the "articles_rdf_data" table is not under the created tablespace "rdf_tblspace", but in the default tablespace "SYSAUX? I created a table space named articles_rdf_data and a network of semantic data using this tablespace. After I created the table "articles_rdf_data" and a semantic model 'items' which uses the created tablespace, and then I logged in the OEM to check it out, I found that this table uses the default tablespace "SYSAUX" rather than created tablespace which I thought that it should use. Thanks in advance.
Kind regards
HongSalvation Hong,
When you created your table in the application "articles_rdf_data" have you set the tablespace?
for example
SQL > create table xyz (i int) tablespace rdf_tblspace;If you don't explicitly set, you must change the default behavior of the user of the session
tablespace. Assume that your user session is scottSQL > ALTER USER scott TABLESPACE DEFAULT rdf_tblspace;
Thank you
Zhe
-
Loading data from multiple tables in essbase using ODI
Hello
We have a scenario where the data comes from more than one table. I would like to know how ODI will load the data for the right combination of membersHello
Consider each data table has a field that corresponds to the other table. You can simply drag the source interface data warehouses and create a join between the tables.
See you soon
John
http://John-Goodwin.blogspot.com/ -
How it warns Oracle to use an index for the join of two tables...
How to prevent the Oracle to use an index for the join of two tables to get a view online that is used in an update statement?
O.K. I think I should explain what I mean:
When you join two tables that have many entries sometimes there're better is not to use an index on the column that is used as a criterion to join.
I have two tables: table A and table B.
Table A has 4,000,000 entries and table B has 700,000 entries.
I have a join of two tables with a numeric column as join criteria.
There is an index on this column in A table.
So I instead of
I want to usewhere (A.col = B.col)
in order to avoid Oracle using the index.where (A.col+0 = B.col)
When I use the join in a select query, it works.
But when I use the join as inline in an update statement I get the error ORA-01779.
When I remove the '+ 0' the update statement works. (The column is unique in table B).
Any ideas why this happens?
Thank you very much in advance for any help.
Hartmut cordiallyYou plan to use a NO_INDEX hint as shown here: http://www.psoug.org/reference/hints.html
-
Multiple Table join result problem
Hello
I am new to oracle
I am facing a problem to the exact result of multiple table.
My query is
Select e . e_name, t . Start_date, a. area_name , t . Branch of the , t . objective, ( t. actual_rtn_dt - t . Start_date) duration
t of tour_info zone a, e method
where actual_rtn_dt is not null
and t. emp_code = e. emp_code
and t. zone = a. Area_Code
order t. start_date;
-----------------------------------------------------------------
Here is the result
MD. KHAIRUL ISLAM 01 SEP-14 DHAKA_3 071 AUTOMATION 6 DEV SUDORSON 02-SEP-14 TRAINING DIISP 2 JUSTINE DIA 04 SEP-14 GAZIPUR HUMAN RESOURCES REVIEW 0 SABRI AL RAHMAN 04 SEP-14 DHAKA_3 071 AUTOMATION WITH PKSF 3 MD. KHALEDUL ISLAM 04 SEP-14 GAZIPUR HUMAN RESOURCES REVIEW 0 GAZI MD. SALAHUDDIN 04 SEP-14 GAZIPUR 0 MD. KHALEDUL ISLAM 06 SEP-14 071 AUTOMATION 0 MD. JULIEE RAHMAN 14-SEPT-11 GAZIPUR TRAINING 2 But I want to, in Bracnh column allows to extract branch_name Bracnh Tbal (I have on the database) as Area_name.
How is it Possible?
Thanks advanced
SELECT e.e_name, t.start_date, a.area_name, --t.branch, (select branch_name from branch_tbl where
=t.branch) branch_name, t.objective, ( t.actual_rtn_dt - t.start_date ) duration FROM tour_info t, area a, emp_info e WHERE actual_rtn_dt IS NOT NULL AND t.emp_code = e.emp_code AND t.area = a.area_code(+) ORDER BY t.start_date; Is that what you are looking for?
Maybe you are looking for
-
TestStand crashes when you use the feature of LENGTH
So I have a problem when you use the TERM built on stage. the first time I run my sequence everything goes normally... the second time I try to run the sequence it freezes teststand. I have notices that when I run my sequence. I can see on TRACK OR t
-
How can I connect the Linksys E1000 to a Canon Mg5320 wireless?
The printer seems to recognize the wifi but does not connect, although even I'm just following the instructions hold the WPS button before clicking 'OK' on the printer.
-
speakers are connected but not detected! Help, please!
I tried to plug in my sound souround in my lap. Well the wires accidentally touched something and then there is a loud noise, of course, we were surprised & so after numerous attempts, trying to have his surround for the computer, we couldn't hear an
-
switch 3750 EAPoL transmission RADIUS server
I have a running version of the 3750 switch stack 12.2 (53) SE2 IPBASEK9-M. I have dot1x configured on the switch and a Windows 7 PC, connected with 802. 1 x configured on the interface. I see the EAPoL start message from the PC, but I do not see the
-
Taskbar Win7 will not be hidden on auto hide.
When a program needs my attention the taskbar keeps popping up when it is on auto hide. Y at - it a setting to prevent this?