Database Design - Multiple Irrelevant Fields

May 15, 2009

I am designing a database as a practice exercise, but have come across a problem.

Here is my design:

Branch Manager Employee
------- ---------- ----------
BranchID ---- ManagerID |---- EmpoyeeID
... | EmployeeID ---- ...
Manager ---- EmployeeIDOfManager
...
Branch

Note: The ... in the tables are just placements symbolizing that there are multiple irrelevant (to this thread) fields.

The problem is with the field highlighted in italics whilst the primary keys are in bold. I need to somehow retrieve that ID, but I can't create a many-to-many relationship.

View 14 Replies


ADVERTISEMENT

SQL & PL/SQL :: Use Distinct For Multiple Fields?

Oct 18, 2011

i have a query in this way

select field1,field2,field3 from Table1
union
select field1,field2,field3 from table2

In the query from table2 i am getting duplicate rows, HOW can i retrieve only distinct rows...Using distinct keyword did not work...if i have to post create and insert statements for this one...

View 3 Replies View Related

Select Fields From Across Multiple Tables?

Mar 25, 2011

I have had a google around and can't seem to find an answer as to how do do the following Select statement. i am wanting to Select the following fields from across multiple tables.

(field.table)
CustName.CUST
SalesNo.SALE
SalesDate.SALE
ItemDes.ITEM
Qty.SALEITEM
OrderComplete.SALEITEM

with 2 types of WHERE criteria:
WHERE SalesDate is between 'dateX' AND 'dateY'
and also WHERE OrderComplete = 'Y'

i understand this will require some sort of join in the statement so the keys for the different tables are as follows:

CUST
CustNo - PK

SALE
SalesNo - PK
CustNo - fk

ITEM
ItemNo - PK

SALEITEM
SalesNo -fk
ItemNo - fk (compound PK)

i have had a play around with using some joins & embedded statements

View 4 Replies View Related

Testing Fields With Multiple Paths?

Jan 18, 2007

My task is to test a field in a certain database. We shall refer to the field as ship_to. There is an algorithm for which the field ship_to is populated and higher up in the algorithm, a variable we shall call X is created. The algorith states that I should assign the variable to ship_to unless X is = -1. If X is = -1, the algorithm continues with multiple joins and assignments. What would be the best way to go about coding this solution. There are 4 individual paths. I have only described the first path, but they are similiar in structure. I was thinking of using either Case's or decodes?The field ship_to is a number. I have already created a statement to test the sum of the Target, but now I need to test the entire algorithm to see if it too sums the Target.

View 1 Replies View Related

SQL & PL/SQL :: UPDATE Multiple Fields Without Where Exist

Jun 17, 2011

I'm updating a big table with an other one (see topic

[URL]........

I was wondering if I could do it without using the WHERE EXISTS condition. Let me explain better:

create table TEST
(
ENT_SIG VARCHAR2(10),
EMP_ID VARCHAR2(10),
DATE_START DATE,
DATE_END DATE
);

create table TEST2
(
ENT_SIG VARCHAR2(10),
EMP_ID VARCHAR2(10),
DATE_START DATE,
DATE_END DATE
);

insert into TEST (ENT_SIG, EMP_ID, DATE_START, DATE_END)
values ('014', '120', TO_DATE('20080101','YYYYMMDD'), TO_DATE('20080131','YYYYMMDD'));
insert into TEST (ENT_SIG, EMP_ID, DATE_START, DATE_END)
values ('014', '121', TO_DATE('20080201','YYYYMMDD'), TO_DATE('20080228','YYYYMMDD'));
[code].....

I'm asking if there's a way to do this:

update test a
set (date_Start, date_end) = (select date_start, date_end
from test2 b
where b.emp_id = a.emp_id
[code].......

Without using the WHERE EXISTS. I don't want to make two accesses to table2, I would like instead to do something like "If subquery returns a row, use it, else keep what you have in destination table".

Is there a way to do it without entering test2 twice?

View 10 Replies View Related

What Will Be Database Design Of Any Food Shop

Mar 21, 2009

i am a beginner in database design.i want to know what will be the database design of any food shop like pizza hut..i have created some tables...i am confuse with design of order table..

employee_details
-ID primary key
-name
-address
-date_of _joining
-salary

product_details
- category_name ,foriegn key
- product_name,primary key
- category
- unit price
-discount

categories
-category_name , primary key

View 3 Replies View Related

Database Design For Storing Client Address Information For All Its Branches?

Jul 27, 2012

I have to design a database so that the performance is optimum and joins are optimum between tables.

Requirement - I have several banks as clients globally, like HSBC, RBS, AMEX etc. Each bank operate globally, and are divided like the geographies, regions etc. For eg. HSBC is operating from US, UK, ASIA, AUSTRALIA. Each geoagraphy is further divided/childs, like, in ASIA has INDIA, PAKISTAN, SRI LANKA, CHINA. Further, it is divided, like in India, it has cities like DELHI, BOMBAY, CHENNAI etc., then further it has within Delhi - Lajpat Nagar, Rohini, Pashim Vihar etc.

As per the above scenario, I need to store addresses, phone numbers, of all the branches of all clients. Also, there is one more condition like in the above defined hierarchy, later on, a new hierarchy can be added, like In INDIA, it can further divided in States and then its local cities.

View 3 Replies View Related

Forms :: Image Path Save In Database And Image Name As Design Number?

Jun 3, 2009

I create a simple table for image

CREATE TABLE image_table (
Design_no varchar2(10),
filename VARCHAR2(255) PRIMARY KEY,
image LONG RAW);

Then i create simple block of image_table

its show me in this website [URL] My question is i don't want to give my form path always.i want to save my picture path in my database and the name of my picture always same as my design_no column.

For example i want to save a picture in my database i will copy my picture in d:shahzaib1234.jpg now i want the path d:shahzaib save in database and when i copy my picture which path= d:shahzaib and file name = Design no its will automatically save in database.

View 4 Replies View Related

Reports & Discoverer :: How To Add Fields From Another Database To EUL

Sep 9, 2010

I am trying to add fields from an SQL server database to the EUL. We have a lot of Oracle tables and fields in the existinging EUL, and we have created a database link from the Oracle database to the SQL database. But how can I find til SQL database tables and fields in Discoverer admin?

View 1 Replies View Related

Server Administration :: Multiple Database With Multiple Instance On Same Machine?

Mar 16, 2011

can we have multiple database version running in a single machine with multiple instances provided there are enough resources.Can we do in RAC only?

View 15 Replies View Related

SQL & PL/SQL :: How To Insert Data In Multiple Bases Using Multiple Database Links

Jan 2, 2013

how to insert the data in multiple bases( Same table structure in different bases) using the multiple database links?

View 4 Replies View Related

Forms :: Fields Not Writing To Database Table

Jul 27, 2010

I have an Oracle Form 6i. There are two blocks. One is a database block called CUSTOMER and the other is a non-database block called CONTROL.

In the PRE-INSERT trigger of the database block, values from the non-database table block are passed to the database table block. When I pass values I use the :BLOCK_NAME.field_name eg. :CUSTOMER.scale_code := :CONTROL.scale.

In this form the values passed to the database block from the non-database block in the PRE-INSERT trigger do not use the block name e.g. :-

:warehouse := :global.default_warehouse;
:capturer :=captured
:scale_code := scale;
:date_captured := sysdate;
insert into dd_audit(cus_id,cap_date) values(:CONTROL.cus_id,SYSDATE);

This application used to work fine for months, last week when writing the values in the PRE-INSERT trigger, just the warehouse field had a value. The remaining fields after the warehouse did not pass any values, although it was verified that values would have been present in the non-database block. The date_captured field should have at least had the system date. The last insert into dd_audit was successful.

I have done numerous tests on our test database and could not replicate the problem. Would passing the values from the non-database block to the database block without the :BLOCK_name preceding the field name cause this problem.

View 4 Replies View Related

SQL & PL/SQL :: Cross Database Join On Fields With Mismatched Data Types

May 31, 2013

I have a editing database with an eversions table:

NAME OWNER
---------------------- --------------------------------
WR5936_DN6676 FRED
WR6739_DN7507 FRED
WR12744_DN13994 FRED
WR6739_DN7511 BARNEY
WR6801_DN7513 BARNEY

I have a process database with a pversions table:

SOID
----------------
5936
6739
12744
6739

I need to select from the editing.eversions table all the records that do not have a matching record in process.pversion. The eversion table is text, and has some additional crap surrounding the characters I want to use for creating a join.

View 3 Replies View Related

Retrieve Info From Multiple Databases / Insert Into Central Database Via Database LINKS

Jun 10, 2013

I am trying to retrieve info from multiple DBs and insert into a central DB via DB LINKS.The links are retrieved via a cursor.

However I keep coming up against 'PL/SQL: ORA-00942: table or view does not exist'..how to handle db_links using a cursor in a pl/sql block? The code is as follows:

DECLARE
db_link_rec VARCHAR2(30);
CURSOR db_link_cur IS
SELECT DB_LINK
from MESSAGING_PROD_LIST;
BEGIN
OPEN db_link_cur;
LOOP
FETCH db_link_cur INTO db_link_rec;
EXIT when db_link_cur%NOTFOUND;
[code]....

View 1 Replies View Related

HR Schema And Jsf Web Design?

Jul 13, 2013

how can ı reach hr schema I watched alot of video and have read so much writing from oracle but my data base haven't HR schema table like
emlployees
countries
jobs

how can ı add these hr schema
2) how can ı create web page with adf web applicaiton jsf

1) adding a search button
2) search fieldand I need to list my search results

View 1 Replies View Related

SQL & PL/SQL :: How To Design Subprogram Which Can Generate Pk Value

Sep 15, 2011

i mean which can generate a primary key when the table name and column name are passed as parameters

View 7 Replies View Related

SQL & PL/SQL :: How To Design ERD For Rental Management

Dec 17, 2012

how to design the ERD for Rental Management like I want know how to design tables to check every month's rent. Is there any way to store month and year with out day in database?

View 2 Replies View Related

SQL & PL/SQL :: Doctors And Patients Design

Mar 9, 2013

Is this true for code

•Employees(employee_id PK)
•Patients(patient_id PK, full_name, age)
•Surgeries( doctorid FK, patient_id FK, surgerydate)

doctor_id number (2) references patients(patient_id),
patient_id number (6) references patients(patient_id),
surgery_date date not null

View 4 Replies View Related

PL/SQL :: Design Features For CSV Files

Dec 17, 2012

I got a couple of reports that are made as .CSV files from PL/SQL. However I am lacking some design features. Is it possible to define text + background color and height + width of fields? (I am using utl_file package.)

View 4 Replies View Related

PL/SQL :: Design Tables Without Primary Key?

Aug 13, 2012

If you were asked to design a schema, would you create a table (however irrelevant) without a primary Key ? Say for example, a 'non-business' table like an Error logging table which logs exceptions thrown from stored procedures, would you create this table without a primary key ?

View 7 Replies View Related

SQL & PL/SQL :: How To Design Subprogram Which Can Generate Primary Key Value

Mar 22, 2012

how to design subprogram which can generate a primary key value whenever the table name and column name are passes as parameter.?

View 19 Replies View Related

Security :: Oracle Audit Design?

May 28, 2011

Let us say I want to audit data updates, deletes on existing table EMP_TAB that has a few hundred thousands of records.I created a shadow table Emp_tab_audit and added few audit columns

Emp_tab (
Empno NUMBER NOT NULL,
Ename VARCHAR2(10),
Job VARCHAR2(9),

[code]...

I am mostly interested in UPDATES and DELETES but I decided to add INSERTS to have full history for each eomplyee in one table (audit schema) instead of querying two tables all the time (production table and audit table) to see the changes.

I created this AFTER INSERT, UPDATE, DELETE trigger.decided to copy the :NEW values for INSERT and UPDATE and :OLD values for DELETE. attached.

so when insert happens, the first audit row is created in EMP_TAB_AUDIT. update happens, the 2nd new row is created in EMP_TAB_AUDIT.

The problem I am facing is the old records that curently exist. If someone updates an old row I am copying the :NEW values so I won't have a copy of the :OLD values unless I create 2 ROWS (one for the old and one for the new).

Do you think I should copy all the hundreds of thousands of records to the AUDIT tables for this to work.

*******************************************************************
CREATE OR REPLACE TRIGGER TRG_EMP_AUDIT
AFTER INSERT OR DELETE OR UPDATE ON EMP_TAB
FOR EACH ROW DECLARE
v_operation VARCHAR2(10) := NULL;

[code]...

View 22 Replies View Related

Forms :: How To Design A Simple Graph

May 23, 2011

How to design a Simple Graph?

View 1 Replies View Related

Functional Design Document For Existing Package

Feb 25, 2013

I would like to design a functional design document for existing package. Let me know is there any tool which will build the design document?

View 8 Replies View Related

Forms :: Design Mode - Horizontal And Vertical Scroll Bar

Oct 25, 2010

How to create horizontal and vertical scrollbar at a time while design mode??

View 2 Replies View Related

Forms :: Design A Form With Header And Line Level?

May 23, 2011

How can we design a form with header level and line level. here i need to place a button in header section.when we press that button, line level values should be populate.

View 1 Replies View Related

PL/SQL :: Master Detail Form And Required Table Design

Feb 28, 2013

I have a contact table that will be used for more than one entity (Customers, Sites, Suppliers, etc.) Using APEX, when we define the master-detail, we need to add a FK to the Detail table -- otherwise the Master-Detail Forms can not be implemented.

I am looking for a way to defined/implemented tables so that I can utilize the same table (Contacts) for more than one Master-details relationship.

View 3 Replies View Related

Forms :: Design Time Insert And Update Allowed For Block

Jan 10, 2011

I create databalock - LC_REQ_PO_ITM_DTLS...In design time Insert and update allowed for that block - YES. While i execute query, i write procedure like this

GO_BLOCK('LC_REQ_PO_ITM_DTLS');
EXECUTE_QUERY;
SET_ITEM_PROPERTY('pb_item_cd', enabled, property_false);
SET_BLOCK_PROPERTY('LC_REQ_PO_ITM_DTLS',INSERT_ALLOWED, PROPERTY_FALSE);
SET_BLOCK_PROPERTY('LC_REQ_PO_ITM_DTLS',UPDATE_ALLOWED, PROPERTY_FALSE);

but when i press execute button , then data comes properly on that bloack..but i click on that block, error comes like this - 'You can not create record here '.and data disappearing..

View 3 Replies View Related

Forms :: How To Design Hierarchical Tree Menu For Calling Reports

Mar 17, 2013

How to design Hierarchical Tree Menu for calling forms & Reports.

View 2 Replies View Related

JDeveloper, Java & XML :: Design Dynamic Table And Insert In A View

Feb 25, 2011

I'm in a situation where i have to design dynamical XML table that gonna get inserted in a view:

late'si consider the following table:

CREATE TABLE FB_XML
(
ID NUMBER(10) NOT NULL,
FB_ID NUMBER(10),
XMLCONTENT CLOB
)

the XML content field have content like the following:

XMLROOT(XMLELEMENT (
"Form",
XMLELEMENT ("elements",
(SELECT XMLAGG (
[code].......

so late consider for the first row i insert for the

* id:1
* fb_id : 25
* xmlcontent:
XMLROOT(XMLELEMENT (
"Form",
[code]........

the code works "fine" here but the xml in the fb_xml table is not EXECUTED it simply escaped by oracle , i know i should add something so that the XML have to execute and generate.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved