Beginner help - faced with natural join as an example
HelloMy apologies for how basic this query probably will, but I am teaching from zero and do not like to move from topic to topic without a good understanding of why I get the results I get, rather than knowing 'it's how he did
I use the guide of the official examination for 1z0 - 051, and 320 page there is the following year:
+ "The table JOB_HISTORY sharing three columns with the same named with the EMPLOYEES table: EMPLOYEE_ID JOB_ID and department_id." You are required to describe the tables and fetch the EMPLOYEE_ID, JOB_ID, +.
+ Values for all rows retrieved using a natural join pure department_id, LAST_NAME, HIRE_DATE and end_date. Alias the table EMPLOYEES as EMP and the table JOB_HISTORY that JH and use dot notation where possible. » +
Their solution (which is about what I came to start with) is:
SELECT employee_id job_id, department_id, emp.last_name, emp.hire_date, JH.end_date
OF JH job_history
NATURAL JOIN employees emp;
This translates into the only employee "Taylor" being returned.
------------------------------
Is it possible someone could 'hold my hand' through this example please? I have no idea why only one result is returned, but in addition, I don't know what else I expected - clearly my understanding of the natural join clause is severely lacking. The book States that:
+ "The execution of this statement returns a single row with the same values EMPLOYEE_ID JOB_ID and department_id in the two tables." +
I guess I'm confused because I thought that the join clauses should deploy additional content to other tables to display, to not limit lines - which is what it sounds like they mean by "returns a single row with the same number and job_id department_id values in the two tables."
I am very confused!
Thanks in advance,
Nick
Hi, Nick.
Nick woodward wrote:
HelloMy apologies for how basic this query probably will, but I am teaching from zero and do not like to move from topic to topic without a good understanding of why I get the results I get, rather than knowing 'it's how he did
Good thinking!
I use the guide of the official examination for 1z0 - 051, and 320 page there is the following year:
+ "The table JOB_HISTORY sharing three columns with the same named with the EMPLOYEES table: EMPLOYEE_ID JOB_ID and department_id." You are required to describe the tables and fetch the EMPLOYEE_ID, JOB_ID, +.
+ Values for all rows retrieved using a natural join pure department_id, LAST_NAME, HIRE_DATE and end_date. Alias the table EMPLOYEES as EMP and the table JOB_HISTORY that JH and use dot notation where possible. » +Their solution (which is about what I came to start with) is:
SELECT employee_id job_id, department_id, emp.last_name, emp.hire_date, JH.end_date
OF JH job_history
NATURAL JOIN employees emp;This translates into the only employee "Taylor" being returned.
------------------------------
Is it possible someone could 'hold my hand' through this example please? I have no idea why the only one result is returned,
This is because there is only one combination of rows from the tables emp and jh such as the join condition is TRUE. In a natural join, the join condition is not specified, so it would be better if you started looking at the equivalent natural join:
SELECT emp.employee_id
, emp.job_id
, emp.department_id
, emp.last_name
, emp.hire_date
, jh.end_date
FROM hr.job_history jh
JOIN hr.employees emp ON emp.employee_id = jh.employee_id
AND emp.job_id = jh.job_id
AND emp.department_id = jh.department_id
;
on the other hand I don't know what I was expecting - clearly my understanding of the natural join clause is severely lacking. The book States that:
+ "The execution of this statement returns a single row with the same values EMPLOYEE_ID JOB_ID and department_id in the two tables." +
I guess I'm confused because I thought that the join clauses should deploy additional content to other tables to display, do not limit the rows...
A join does both. Each row in the result set can have columns (or drift) the columns in the table and it can have any row of a table associated with the lines of all (or part) of the other table. There are 107 lines in the emp table and 10 rows in the table of jh. This means that could result in a join 2 tables can 0-107 * 10 = 1070 lines. If the join conditions are so strict that no combination of lines met, then the result set has 0 rows. However, if they are so loose that all combinations of lines 2 brands joins tables condition TRUE, then each of the 107 rows in the emp table will join each of the 10 lines in the table of jh.
Try to play with the join condition and see what happens. For example, we will comment on 2 of the 3 parts of the join condition, so that the only condition on the left is "emp.employee_id = jh.employee_id". Also, we'll include a few other columns in the table of jh and no poster not dates, just to make room for the new coplumns. So, if we execute this query:
SELECT emp.employee_id
, emp.job_id
, emp.department_id
, emp.last_name
-- , emp.hire_date -- Commented out to save space
-- , jh.end_date -- Commented out to save space
, jh.job_id -- For debugging
, jh.department_id -- For debugging
FROM hr.job_history jh
JOIN hr.employees emp ON emp.employee_id = jh.employee_id
-- AND emp.job_id = jh.job_id
-- AND emp.department_id = jh.department_id
;
then we get these results:
EMPLOYEE DEPARTMENT DEPARTMENT
_ID JOB_ID _ID LAST_NAME JOB_ID _ID
-------- ---------- ---------- ---------- ---------- ----------
101 AD_VP 90 Kochhar AC_ACCOUNT 110
101 AD_VP 90 Kochhar AC_MGR 110
102 AD_VP 90 De Haan IT_PROG 60
114 PU_MAN 30 Raphaely ST_CLERK 50
122 ST_MAN 50 Kaufling ST_CLERK 50
176 SA_REP 80 Taylor SA_REP 80
176 SA_REP 80 Taylor SA_MAN 80
200 AD_ASST 10 Whalen AD_ASST 90
200 AD_ASST 10 Whalen AC_ACCOUNT 90
201 MK_MAN 20 Hartstein MK_REP 20
10 rows selected.
Why do we get only 10 lines? There are other employee_ids, such as 100 and 206 in the emp table. Why do we see these employee_ids in the results? In addition, the emp.employee_id is unique; in other words, no 2 rows in the emp table have the same employe_id. How the result set can have two lines with the same employee_ids, such as 101 or 200?
Now try to do the more difficult condtion join, by a non-commenting on the terms that we have commented earlier:
SELECT emp.employee_id
, emp.job_id
, emp.department_id
, emp.last_name
-- , emp.hire_date
-- , jh.end_date
, jh.job_id
, jh.department_id
FROM hr.job_history jh
JOIN hr.employees emp ON emp.employee_id = jh.employee_id
AND emp.job_id = jh.job_id -- *** CHANGED ***
-- AND emp.department_id = jh.department_id
;
The results are now:
EMPLOYEE DEPARTMENT DEPARTMENT
_ID JOB_ID _ID LAST_NAME JOB_ID _ID
-------- ---------- ---------- ---------- ---------- ----------
200 AD_ASST 10 Whalen AD_ASST 90
176 SA_REP 80 Taylor SA_REP 80
He was 2 of 10 lines in the previous result set. What happened to the other 8 lines that have been in this result set? Fior example, why has this line:
EMPLOYEE DEPARTMENT DEPARTMENT
_ID JOB_ID _ID LAST_NAME JOB_ID _ID
-------- ---------- ---------- ---------- ---------- ----------
176 SA_REP 80 Taylor SA_MAN 80
in the result of 10 rows value (produced by the query with a join condition only 1), but not in the result of 2 ranks (produced by the query with the additional condition 'AND emp.job_id = jh.job_id')?
If you do not completely understand the natural joins, don't worry too much. In practice, nodody uses a natural join. However, natural joins are a type of INNER join and inner joins are extremely frequent. It is very important for you to understand how joins inside, such as the 2 I posted more top, work.
Published by: Frank Kulash, March 18, 2013 17:08
Results and applications added
Tags: Database
Similar Questions
-
Hello!
I learn SQL and I have a lot of doubts but I think with this example I can generalize.
I have the tables:
Book {idbook (PK), namebook}
auhor {idauthor (PK), nameauthor, idcountry (FK)}
fatherhood {idauthor (FK), idbook (FK)} (both the same strain of PK)
country {idcountry (PK), namecountry}
I want the name of the books that are the authors of the Canada.
I assumed that a correct query would be:
SELECT namebook FROM book NATURAL JOIN (paternity NATURAL JOIN (author country NATURAL JOIN)) WHERE country.namecountry = 'Canada ';
The result I was waiting for was:
Book3
Book5
but this query returns me all the books that have relationships in the co-author (with the authors of all countries), 2 times! as:
Book2
book3
Book4
Book5
Book2
book3
Book4
Book5
the best I can do to get my correct result is:
SELECT namebook FROM book NATURAL JOIN (author, NATURAL JOIN) WHERE author.idcountry = 2;
But of course I can't use this one...
Can someone explain to me what is happening?
Thank you very much!
Published by: user12040235 on 10/15/2009 09:37
Published by: user12040235 on 10/15/2009 09:51Hello
Maybe it's a bug.
Get the correct results (2 ranks) to Oracle 10.1, but I get the same bad results you (12 rows) in Oracle 11.1.
In Oracle 11, I get results so say "SELECT *" instead of "SELECT book.namebook".
I also get the correct results, if I add the join columns in the SELECT clause. Adding a column to join no, for exampleSELECT BOOK.namebook, author.nameauthor FROM book ...
Gets results.
In the interest of all those who want to try this:
DROP TABLE author; create table author AS SELECT 1 AS idauthor, 'Jose Luiz do Rego' AS nameauthor, 1 AS idcountry FROM dual UNION ALL SELECT 2, 'Barbara Bela', 2 FROM dual UNION ALL SELECT 3, 'Juan Domingues', 5 FROM dual UNION ALL SELECT 4, 'José Mauro de Vasconcelos', 1 FROM dual UNION ALL SELECT 5, 'Vader', 2 FROM dual UNION ALL SELECT 6, 'navathe', 4 FROM dual UNION ALL SELECT 7, 'Machado de Assis', 1 FROM dual ; drop table AUTHORSHIP; CREATE TABLE authorship AS SELECT 2 AS idauthor, 5 AS idbook FROM dual UNION ALL SELECT 1 AS idauthor, 1 AS idbook FROM dual UNION ALL SELECT 5 AS idauthor, 3 AS idbook FROM dual UNION ALL SELECT 6 AS idauthor, 2 AS idbook FROM dual UNION ALL SELECT 7 AS idauthor, 4 AS idbook FROM dual UNION ALL SELECT 7 AS idauthor, 6 AS idbook FROM dual; drop table book; CREATE TABLE book AS SELECT 1 AS idbook, 'book1' AS namebook FROM dual UNION ALL SELECT 2 AS idbook, 'book2' AS namebook FROM dual UNION ALL SELECT 3 AS idbook, 'book3' AS namebook FROM dual UNION ALL SELECT 4 AS idbook, 'book4' AS namebook FROM dual UNION ALL SELECT 5 AS idbook, 'book5' AS namebook FROM dual UNION ALL SELECT 6 AS idbook, 'book6' AS namebook FROM dual UNION ALL SELECT 7 AS idbook, 'book7' AS namebook FROM dual; DROP TABLE country; CREATE TABLE country AS SELECT 1 AS idcountry, 'Brazil' as namecountry FROM dual UNION ALL SELECT 2 AS idcountry, 'Canada' as namecountry FROM dual UNION ALL SELECT 3 AS idcountry, 'Chile' as namecountry FROM dual UNION ALL SELECT 4 AS idcountry, 'Venezuela' as namecountry FROM dual UNION ALL SELECT 5 AS idcountry, 'USA' as namecountry FROM dual UNION ALL SELECT 6 AS idcountry, 'Argentina' as namecountry FROM dual ;
-
A curious "anomaly" with the NATURAL JOIN compared to join HER for HELP
The following query returns I expect since the HR [106 lines] schema:
Select last_name, department_name of departments who JOIN employees USE (department_id);
However, when I do the full natural join with this, I get only 32 ranks.
Select last_name, department_name of the departments of NATURAL JOIN employees;
The complete NATURAL JOIN not use department_id join on? But if not what else would it use? I just stumbled on this and am especially curious that I do not use the syntax of natural join in production but prefer instead the JOIN now.
Thank you.The NATURAL keyword indicates that a natural join is underway. A natural join is based on all of the columns in the two tables with the same name. He selects the rows of two tables that have equal values in the corresponding columns.
-
I have the following table structure,
_ Table - 1
---------------------------------
ID | Information
---------------------------------
1. abcadskasasa
2. asdasdasdasd
3. saeqdfdvsfcsc
---------------------------------
_ Table - 2
---------------------------------
ID | NEST
---------------------------------
1. 12
1. 13
2. 14
1. 15
1. 16
2. 12
---------------------------------
_ Table - 3
---------------------------------
ID | THIERRY
---------------------------------
1. 12
2. 14
1. 15
---------------------------------
Now, I want to choose for each ID in table 1 and the number of MIP in the table 2-number of THIERRY of table 3.
Desired output:_
---------------------------------------------------------------------------------------------------
ID | COUNT_PID | COUNT_PARID
---------------------------------------------------------------------------------------------------
1. 4. 2
2. 2. 1
3. 0 | 0
---------------------------------------------------------------------------------------------------
Could someone please help me with this. I'm doing using outer joins, but as I work mainly at the edge of the end, not able to reach an appropriate solution to that above.
Thanks in advance,
TejasYou should not outer join... That should do it...
select ID , (select count(PID) from table2 t2 where t2.id = t1.id) , (select count(PARID) from table3 t3 where t3.id = t1.id) from table1
-
Incorrect results of natural join producing. I was wondering why.
If anyones got a second, I have a small question about this bit of code. It seems that he should produce good results, but does not work.
"Write a query to identify the highest salary paid in each country. It will take by using a subquery in the FROM clause. »
It is the obvious answer:
"select max (salary), country_id of."
(select department_id, location_id, salary, country_id of)
employees join natural services locations of natural join)
Country_id group; »
Here are the results:
17000 WE
CA 6000
10000 UK
I wrote this instead:
Select max (salary), country_id of
(select d.department_id, l.location_id, c.country_id, e.salary, c.country_name
e employees
Join departments d on (e.department_id = d.department_id)
Join places l on (d.location_id = l.location_id)
Join country c on (l.country_id = c.country_id)
)
Country_id group;
Which produces:
24000 WE
13000 CA
10000 OF
14000 UK
(Of course it also works with 'join using (column_name)')
My answers look correct when passing through the countries/places/employee tables manually - look of the wrong example.
I guess its something to do with the natural join? Maybe his join tables somewhere on several columns? I would like to understand exactly why the first example is if bad - because I sure hope will teach me more about why avoid natural joins.
Also, are there ways to improve outcomes, for example if I was watching an average salary? I drew the tables to try to find ways that the records may be left out, and where the outer joins might be useful. The only thing I could think of would be that a Department/location not assigned a place/country respectively. But I'm not an outer join would allow it at all except if I created some NVL2 code to assign new place/country IDs based on other areas - I think that's a bit much for this example.
Thank you very much
Nick
Published by: nick woodward on April 22, 2013 11:10
Published by: nick woodward on April 22, 2013 11:12Hi, Nick.
Nick woodward wrote:
If anyones got a second, I have a small question about this bit of code. It seems that he should produce good results, but does not work."Write a query to identify the highest salary paid in each country. It will take by using a subquery in the FROM clause. »
In fact, a subquery in the FROM clause is not yet useful, at least not for me, and it is certainly not necessary.
It is the obvious answer:
"select max (salary), country_id of."
(select department_id, location_id, salary, country_id of)
employees join natural services locations of natural join)
Country_id group; »Here are the results:
17000 WE
CA 6000
10000 UKI wrote this instead:
Select max (salary), country_id of
(select d.department_id, l.location_id, c.country_id, e.salary, c.country_name
e employees
Join departments d on (e.department_id = d.department_id)
Join places l on (d.location_id = l.location_id)
Join country c on (l.country_id = c.country_id)
)
Country_id group;Which produces:
24000 WE
13000 CA
10000 OF
14000 UK(Of course it also works with 'join using (column_name)')
AID is not as bad as NATURAL JOIN, but it's pretty bad. Forget the JOIN... Help me, just like you should forget NATURAL JOIN.
My answers look correct when passing through the countries/places/employee tables manually - look of the wrong example.
I guess its something to do with the natural join? Maybe his join tables somewhere on several columns?
Exactly; There is a column manager_id employees and also in the departments.
If the obligation is to get the highest salary of all employees in a country, then NATURAL JOIN does not meet the requirements.I would like to understand exactly why the first example is if bad - because I sure hope will teach me more about why avoid natural joins.
Do you need any other reasons?
Also, are there ways to improve the results
As I said earlier, you don't need a subquery for this.
In addition, you must the country table if you want to display the country_name, or if you need to reach the region table. In this problem, all you need is the country_id and you can get that from the communities table, then the following text also gets good results:SELECT MAX (e.salary) AS max_salary , l.country_id FROM employees e JOIN departments d ON d.department_id = e.department_id JOIN locations l ON l.location_id = d.location_id GROUP BY l.country_id ORDER BY l.country_id ;
Whenever a request is for 2 or more tables, it is recommended to describe each column with a table name or alias.
say if I watched an average salary?
You can use AVG much lke you use MAX. You can do both in the same query, if you wish; See the example below.
I drew the tables to try to find ways that the records may be left out, and where the outer joins might be useful. The only thing I could think of would be that a Department/location not assigned a place/country respectively.
Right; outer joins are useful when you want to get data from the table or not a matching rows in the table b. Departaments that have not been allocated a location is a situation that calls for an outer join. Another example is the country who have no departments in them. (There is a real possibility. You can set up a table with all countries in the world already in it, not because you'll need all of them, but because you might need one of them.)
But I'm not an outer join would allow it at all except if I created some NVL2 code to assign new place/country IDs based on other areas - I think that's a bit much for this example.
Not necessarily. Sometimes all you need is the NULL that you get automatically for all columns of table b when you say
FROM a LEFT OUTER JOIN b ...
and one has no corresponding row in the b
For example, if you want to include all countries in the table of localities, with the salary maximum and average of those that have employees, you can get these results:
MAX_SALARY AVG_SALARY CO ---------- ---------- -- AU BR 13000 9500 CA CH CN 10000 10000 DE IN IT JP MX NL SG 14000 8885.71429 UK 24000 5064.70588 US
without using NVL, or NVL2 or something like that. In fact, only the functions you need are AVG and MAX.
Try it.Published by: Frank Kulash on April 22, 2013 16:35
-
Hello
Faced with a failure of OSD task sequence.
The failure messages in the end are:
--------------------------------------------------
Has no file WIM mount 0 x 80070002
Cannot create media 0 x 80070002
CreatTSMedia failed with error 0 x 80070002 details MediaGenerator
--------------------------------------------------------------------------------------------
It comes via SCCM 2007 R3 and a version of Windows XP.
I think 0 x 80070002 means "the system cannot find the file specified."
But what file?
How do you determine what the media Wizard is missing to generate this error?
Is this a driver problem?
Thank you
John
Hello
The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums. You can follow the link to your question:
http://social.technet.Microsoft.com/forums/en/configmgrosd/threads
Hope this information helps.
-
I'm trying to uninstall a printer, but only part of it was uninstalled, there are 2 parts more than the necessary printer uninstalled and I get the message setup.exe has stopped working
Hello
· Faced with this problem specific to uninstalling the application with the printer, or with another application?
· What is the brand and model of the printer?
You can follow the method below and check if it helps.
Method 1:
I would say as you put your computer in a clean boot state and check if it works.
How to troubleshoot a problem by performing a clean boot in Windows
http://support.Microsoft.com/kb/929135
Note: Don't forget to reset the computer to start as usual, once the problem is resolved. Follow step 7 on top of the kb article.
Method 2:
I suggest to install the application printer again and then try to uninstall it, if only the problem is specific to the printer.
http://Windows.Microsoft.com/en-in/Windows-Vista/uninstall-or-change-a-program
Hope this helps,
-
I am a newbie to SQL and I studied the book of Fundamentals SQL Server Oracle OCA 12 c, but a section on natural joins to confuse me.
Basically, the author says:
SELECT r.region_name, d.department_name, l.city, c.country_name
DEPARTMENTS d
NATURAL JOIN places l, c countries, regions r;
The natural join between DEPARTMENTS and LOCATIONS creates a provisional result, consisting of 27 lines since they are implicitly attached on the column of location_id. This set is then Cartesian-joined to the table of the COUNTRY as a join condition is not implicitly or explicitly specified. 27 interim lines are attached to 25 lines in the COUNTRY table, which gives a new temp results set with 675 (27 × 25) rows and three columns: DEPARTMENT_NAME, CITY and COUNTRY_NAME. This set is then attached to the REGION table. Once more, a Cartesian join occurs because column REGION_ID is absent from any join condition. The final result set contains rows and four columns (675 × 4) 2700.
I can understand because you evaluate joins from the left. But then he wrote:
The JOIN... USE and JOIN... ON the syntaxes are better suited to join multiple tables. The following query joins four tables using the natural join syntax:
SELECT country_id region_id, c.country_name, l.city, d.department_name
DEPARTMENTS d
NATURAL JOIN places l
NATURAL JOIN country c
NATURAL JOIN region r;
This query generates correctly 27 lines in the final results set since the required join columns are listed in the SELECT clause. The following query illustrates how the JOIN... CLAUSE is used to extract the same 27 lines. A join condition can reference columns only in its scope. In the following example, the join of DEPARTMENTS slots can not reference columns in the COUNTRIES or REGIONS of tables, but the join between the COUNTRIES and REGIONS may refer to any column of four tables involved in the query.
This second method of the part of the natural writing joined confuses me. I don't understand the logic behind the 2nd series of States of Natural Join. For me, it seems that the first series and the 2nd set look alike, but they are apparently not.
Can someone tell me the differences?
Thank you!!
Hello
The more important thing to learn more about NATURAL JOIN is: never use it. If you add new columns, joins can get different results. I've never heard of someone uisng NATURAL JOIN apart from a manual or a question like yours.
There are a lot of things in Oracle that take the time to learn and are useful. All the time you spend learning things is better spent on them.
-
Natural join of Table to herself out of Cartesian product
Hello
With
CREATE TABLE A)
an INTEGER,
b VARCHAR (15).
c DATE
);
INSERT IN A (a, b, c) VALUES (1, 'AAA', SYSDATE);
INSERT IN A (a, b, c) VALUES (2, 'BBBB', SYSDATE);
INSERT IN A (a, b, c) VALUES (3, 'CCCCC', SYSDATE);
CREATE VIEW A1
AS SELECT * FROM A
;
the query
SELECT
*
A.
NATURAL JOIN HAS
;
returning nine records - but
SELECT
*
A.
NATURAL JOIN A1
;
only three - which is what I expected.
Why the difference?
Tested in 11g. Where is the documentation pertaining to this particular aspect?
Thank you!
Report it as a bug, the correct result, it's the three ranks of result you can go back to giving has an alias, for example:
SQL > select * a natural join a and b;
A B C
---------- --------------- ---------
1 AAA 15 JULY 15
2 BBBB 15 JULY 15
3 CARTER 15 JULY 15
3 selected lines.
SQL > select * from a natural join.
A B C
---------- --------------- ---------
1 AAA 15 JULY 15
1 AAA 15 JULY 15
1 AAA 15 JULY 15
2 BBBB 15 JULY 15
2 BBBB 15 JULY 15
2 BBBB 15 JULY 15
3 CARTER 15 JULY 15
3 CARTER 15 JULY 15
3 CARTER 15 JULY 15
9 selected lines.
Run on 11.2.0.4 - but reproduced on 12.1.0.2
Concerning
Jonathan Lewis
-
I am a student, I want to buy the plan of all the apps, but I already bought Acrobat Pro DC subscription (one year), it seems that I can't go to a student, could you help me with this? Thank you.
Since this is an open forum, not Adobe support... you must contact Adobe personnel to help
Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">===>
Don't forget to stay signed with your Adobe ID before accessing the link below
Creative cloud support (all creative cloud customer service problems)
http://helpx.Adobe.com/x-productkb/global/service-CCM.html
Having support cancel your current subscription and then down below
Adobe in education... Start here https://creative.adobe.com/join/edu
Educational https://creative.adobe.com/plans?plan=edu
FAQ https://helpx.adobe.com/x-productkb/policy-pricing/education-faq.html
When you purchase a subscription to education, the terms you "click to accept" should be clear about the first/last years
-Intro price http://forums.adobe.com/thread/1448933?tstart=0 one can help
http://www.Adobe.com/products/creativecloud/students.edu.html
http://www.Adobe.com/education/students/student-eligibility-Guide.edu.html
Redemption Code https://creative.adobe.com/educard
Proof of ID http://www.adobe.com/store/au_edu/academic_id.html
-
Please help me with the issue of the image
Hello
I need to create a report of error log which two same named images overlapped together.
The image above shows how is my page indesign file. I need the report as error log:
With overlapping of images: photo_sample3.jpg
Logic:
I don't know what logic I need to use to get there. But with my knowledge, I thought, I can use the image name and the value of geometric image to achieve. I found a script that gives the number duplication, if any of this page in this page of this forum.
var overlapArray = new Array(); var myPages = app.activeDocument.pages.everyItem().getElements(); for(i=0; i<myPages.length; i++) { var myPgItems = myPages[i].allPageItems; for(k=0; k<myPgItems.length; k++) { var bounds1 = myPgItems[k].geometricBounds; for(j=0; j<myPgItems.length; j++) { var bounds2 = myPgItems[j].geometricBounds; if(k==j) { continue; } var temp = touches(bounds1, bounds2); if(temp == true) { overlapArray.push(myPages[i].name) } } } } alert("overlap Pages: "+overlapArray); function touches(bounds1, bounds2) { if (bounds1[2] < bounds2[0]) return false; if (bounds1[0] > bounds2[2]) return false; if (bounds1[1] > bounds2[3]) return false; if (bounds1[3] < bounds2[1]) return false; return true; }
Please help me with script or logic.
Thank you in advance,
Kitty
Hi well,.
all was needed was a line of code
Array.prototype.intersect = function ( coordinates ) { var n = this.length; var nY1, nX1, nY2, nX2; var y1 = coordinates[0]; var x1 = coordinates[1]; var y2 = coordinates[2]; var x2 = coordinates[3]; while ( n-- ) { nY1 = this[n][0]; nX1 = this[n][1]; nY2 = this[n][2]; nX2 = this[n][3]; if ( ( ( y1>=nY1 && y1<=nY2 ) && (x1>=nX1 && x1<=nX2 ) ) || ( ( y2>=nY1 && y2<=nY2 ) && (x2>=nX1 && x2<=nX2 ) ) ){ return true; } } return false; } function reportOverlaps() { var doc,gs, g, n, o = {}, p, pg, pb, lk, lkn, overlaps = []; if (!app.documents.length) return; doc = app.activeDocument; gs = doc.allGraphics; n = gs.length; while ( n-- ) { g = gs[n]; p = g.parent; pg = p.properties.parentPage; if ( pg instanceof Page ) { pb = p.visibleBounds; lk = g.itemLink; lkn = lk.name; if ( !o[pg.name] ) { o[pg.name] = o[pg.name] || {}; } if ( !o[pg.name][lkn] ) { o[pg.name][lkn] = o[pg.name][lkn] || []; o[pg.name][lkn][ o[pg.name][lkn].length ] = pb; } else { var intersect = o[pg.name][lkn].intersect ( pb ); intersect && overlaps[ overlaps.length ] = "Pg:"+pg.name+"//"+lkn; o[pg.name][lkn][ o[pg.name][lkn].length ] = pb; } } } alert( overlaps.length? "Following overlaps where found:\r"+overlaps.join('\r' ) : "No overlaps found" ); } reportOverlaps();
Loïc
www.ozalto.com
-
I am faced with a task.
I am faced with a task - need to get rid of him.
I have successfully used the 3D camera and followed all the points, selected three points thanks to a target, put a blanket on the task, adjusted to the right size with point angle etc.. When I test the clip the dressing does not follow the movement of the person. Original camera is on a tripod. The movement of the person is minimal - moving from one foot to the other. There's a Kubota moving in the background.
If I could photoshop every image I want. It would be easier. The short clip is long 1m09sec.
Any advice out there? I worked three days straight on tutorials trying to figure out what I'm doing wrong, nothing helps.
Thank you.
If the object/person moves, the 3D camera Tracker isn't the right tool for the job. It's for when the movement in the scene is entirely because of the camera.
If you are tracking just a spot and trying to blur, and then draw a mask around the task, use the tracker mask to follow the mask and use a mask effect to limit the effect to inside of the mask.
Or using mocha.
Or use point tracker.
-
Why FULL NATURAL JOIN work?
Select * from version of v$.
Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
Why these constructions are analysed with success and full/cross/left are ignored?
Select * from
(select 1 of the double)
natural full join
(select 2 from two);
Select * from
(select 1 of the double)
natural left join
(select 2 from two);
Select * from
(select 1 of the double)
right to natural join
(select 2 from two);
Select * from
(select 1 of the double)
cross the natural join
(select 2 from two);
The same time if we try to alias tables it gets an error:
Select * from
(select double 1) t1
natural full join
(select double 2) t2;
ORA-00905: lack of keyword
00905 00000 - 'lack the key word'
* Cause:
* Action:
Error on line: column 5: 29
Published by: Slobodcicov on November 28, 2012 23:46Try this...
select * from (select 1 a from dual) t1 natural full join (select 2 a from dual) t2;
A
--
2
1See you soon,.
Manik. -
date max with multiple joins of tables
Looking for expert advice on the use of max (date) with multiple joins of tables. Several people have tried (and failed) - HELP Please!
The goal is to retrieve the most current joined line of NBRJOBS_EFFECTIVE_DATE for each unique NBRJOBS_PIDM. There are several lines by PIDM with various EFFECTIVE_DATEs. The following SQL returns about 1/3 of the files and there are also some multiples.
The keys are PIDM, POSN and suff
Select NBRJOBS. NBRJOBS.*,
NBRBJOB. NBRBJOB.*
of POSNCTL. Inner join of NBRBJOB NBRBJOB POSNCTL. NBRJOBS NBRJOBS on (NBRBJOB. NBRBJOB_PIDM = NBRJOBS. NBRJOBS_PIDM) and (NBRBJOB. NBRBJOB_POSN = NBRJOBS. NBRJOBS_POSN) and (NBRBJOB. NBRBJOB_SUFF = NBRJOBS. NBRJOBS_SUFF)
where NBRJOBS. NBRJOBS_SUFF <>'LS '.
and NBRBJOB. NBRBJOB_CONTRACT_TYPE = 'P '.
and NBRJOBS. NBRJOBS_EFFECTIVE_DATE =
(select Max (NBRJOBS1. NBRJOBS_EFFECTIVE_DATE) as 'EffectDate '.
of POSNCTL. NBRJOBS NBRJOBS1
where NBRJOBS1. NBRJOBS_PIDM = NBRJOBS. NBRJOBS_PIDM
and NBRJOBS1. NBRJOBS_POSN = NBRJOBS. NBRJOBS_POSN
and NBRJOBS1. NBRJOBS_SUFF = NBRJOBS. NBRJOBS_SUFF
and NBRJOBS1. NBRJOBS_SUFF <>'LS '.
and NBRJOBS1. NBRJOBS_EFFECTIVE_DATE < = to_date('2011/11/15','yy/mm/dd'))
order of NBRJOBS. NBRJOBS_PIDMWelcome to the forum!
We don't know what you are trying to do.
You want all of the columns in the rows where NBRJOBS_EFFECTIVE_DATE is the date limit before a given date (November 15, 2011 in this example) for all rows in the result set with this NBRJOBS_PIDM? If so, here is one way:with GOT_R_NUM as ( select NBRJOBS.NBRJOBS.*, NBRBJOB.NBRBJOB.* -- You may have to give aliases, so that every column has a unique name , rank () over ( partition by NBRJOBS.NBRJOBS_PIDM order by NBRJOBS.NBRJOBS_EFFECTIVE_DATE desc ) as R_NUM from POSNCTL.NBRBJOB NBRBJOB inner join POSNCTL.NBRJOBS NBRJOBS on (NBRBJOB.NBRBJOB_PIDM = NBRJOBS.NBRJOBS_PIDM) and (NBRBJOB.NBRBJOB_POSN = NBRJOBS.NBRJOBS_POSN) and (NBRBJOB.NBRBJOB_SUFF = NBRJOBS.NBRJOBS_SUFF) where NBRJOBS.NBRJOBS_SUFF != 'LS' -- Is this what you meant? and NBRBJOB.NBRBJOB_CONTRACT_TYPE ='P' and NBRJOBS.NBRJOBS_EFFECTIVE_DATE <= to_date ('2011/11/15', 'yyyy/mm/dd') ) select * -- Or list all columns except R_NUM from GOT_R_NUM where R_NUM = 1 order by NBRJOBS_PIDM ;
Normally this site does not display the <>inequality operator; He thinks it's some kind of beacon.
Whenever you post on this site, use the other inequality operator (equivalent), *! = *.I hope that answers your question.
If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) for all the tables involved and the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using.
You will get better results faster if you always include this information whenever you have a problem. -
Select *.
FROM table1 t1
Join table2 t2 on t1.pkid = t2.pkid
These aren't my real table names, but this structure is sufficient to generate my mistake. Clearly I can't join syntax. After Google search, I tried various permutations, with the join condition in parens, prefacing the names table with the schema and stuff like that. No change - always get ora00933.
The only thing that worked was comma-ing, the tables and put the join condition in a where clause clause. Who doesn't for me in the end because the full query I need joined much more and it'll look terrible like that.
Little help on just a simple inner join?
Thank you!
Edited by: sherifffruitfly January 4, 2011 10:18The ANSI join syntax was introduced in Oracle in version 9.1. Your version has been out of favor for a dozen years, and is the latest version of Oracle 11.2.
Unless you can move to something of this century, to do joins in the where clause.
John
Maybe you are looking for
-
I sent a text to a friend of mine who is a user of iPhone 5 s. She wants to convey my text on someone else. I want to know if it transfers on my original text, will be the person shes sending to then have my phone number? Thank you
-
HP laptop - 15-r100ne: increase the Ram
Hello I am owner of a proude of 2 computers HP Laptops: the old G62-100SL http://support.HP.com/us-en/product/HP-G62-100-notebook-PC-series/4078809/model/4171521/product-info... and the new HP for laptop - 15-r100ne http://support.HP.com/us-en/produc
-
WD1001FALS hard drive does not start in my dell dimension e520
I bought a hard drive of WD1001FALS Western digital 1 TB, only to discover, it is a hard drive to the mac. I have researched and formatted NTFS system with my old hard drive, but when I try to boot without the former that it does not load, just on th
-
I plan to change my app in app purchase paid, but I don't really know how to do this or if it's feasible. My first thought is to withdraw the product in application (digital good) and give his name to the SKU ID of the application. Thus, for example
-
BlackBerry Smartphones is "BOLD" works under Windows 2000?
I use my laptop to the company, but the thing is that the laptop can be installed windows 2000. Can I still use "BOLD"?