Sql*loader help needed!!

I am loading data using the SQLLDR utility of Oracle. I defined one column as seq. I am loading the data, it is working properly but next column is not loaded correctly.
Problem :
First Character in the second column was missing. Please help me how to correct the ctl file.
Table:
CREATE TABLE SEQ_TAB1 (
A_ID NUMBER (10) NOT NULL,
A_NAME VARCHAR2 (25) NOT NULL,
A_TYPE VARCHAR2(25)
Seqence : t_seq1 (a_id)
Data file:
Alabama,first
Alaska,ice
California,hot
Texas,time
CTL file :
LOAD DATA
APPEND INTO TABLE seq_tab1
a_id "t_seq1.nextval" ,
a_name char terminated by "," ,
a_type char terminated by ","
Command :
sqlldr username/password@service_name control=ctl_file log=log_file data=data_file
The following way data has been loaded into the table.
1,labama,first
2,laska,ice
3,alifornia,hot
4,exas,time

Try with position specified for the a_name column....
CTL file :
LOAD DATA
APPEND INTO TABLE seq_tab1
a_id "t_seq1.nextval" ,
a_name position(1) char terminated by "," ,
a_type position(*) char terminated by ","
I am loading data using the SQLLDR utility of Oracle. I defined one column as seq. I am loading the data, it is working properly but next column is not loaded correctly.
Problem :
First Character in the second column was missing. Please help me how to correct the ctl file.
Table:
CREATE TABLE SEQ_TAB1 (
A_ID NUMBER (10) NOT NULL,
A_NAME VARCHAR2 (25) NOT NULL,
A_TYPE VARCHAR2(25)
Seqence : t_seq1 (a_id)
Data file:
Alabama,first
Alaska,ice
California,hot
Texas,time
CTL file :
LOAD DATA
APPEND INTO TABLE seq_tab1
a_id "t_seq1.nextval" ,
a_name char terminated by "," ,
a_type char terminated by ","
Command :
sqlldr username/password@service_name control=ctl_file log=log_file data=data_file
The following way data has been loaded into the table.
1,labama,first
2,laska,ice
3,alifornia,hot
4,exas,time

Similar Messages

  • Sql loader help needed  urgent

    Hi,
    I normally get a csv having data as
    column1 ;columnb;columnc;
    13 ; 12 ; 13 ;
    11 ;13 ;33;
    as the table where it needs to go is say table
    xys( a number, b number , c number).
    so the control file is fairly simple ...
    But from now I need to restrict data entry if the change in format happens in the csv
    say if it is like
    column2;column1;column3,
    12,13;12;
    11;13;14;
    or say the csv like
    column1;column2;column3;column4;
    11;13;14;15;
    111;134;14;12;
    in both cases sql loader should not run and throw the error saying the reason in the log.
    how do i manage it in the control file `???
    any ideas???
    regards
    Message was edited by:
    SHUBH

    Hello,
    do you only need to check the first line of the file if it contains a line like
    column1;column2;column3 ?
    If yes, maybe a small script like this could be a starting point:
    You have to replace "column1;column2;column3" with the header information that's valid and instead of file1 in the CURRENTSTRING=... Line write the name of your input file.
    I hope this helps. (But maybe some of the experts here knows a way to do the verification checks with SQLLDR, so maybe its worth to wait a little bit :)
    #!/bin/ksh
    VALIDSTRING="column1;column2;column3"
    CURRENTSTRING=`head -n 1 file1`
    if [[ $VALIDSTRING == $CURRENTSTRING ]]
    then
    echo "They match."
    else
    echo "They dont match."
    fi
    --

  • SQL Server2008 help needed

    Having trouble with SQLServer 2008 (not MySQL) and my database connection in Dreamweaver CS6.  My document type is set as .asp using VBScript.  I can list the table information  but cannot use the insert wizard to add new records.  I don't get any errors after creating the insert form, but no records get inserted.  I'm not a VBScript expert, but do I have to manually write some code to insert records?  How do I attach it to a button?

    Thanks for the quick reply.  I won't be back in the office for a few days, but I'll try to post it when I get back in.  It's pretty much the code generated from the Dreamweaver Insert Record wizard.  I see where the submit button is created and the value is set but the action on the form is set to MM_insert, so I don't see where the submit code is actually called.
    Date: Wed, 3 Oct 2012 12:06:14 -0600
    From: [email protected]
    To: [email protected]
    Subject: SQL Server2008 help needed
        Re: SQL Server2008 help needed
        created by bregent in Dreamweaver General - View the full discussion
    This post should be moved to the app dev forum.  Please post the code from your form and the insert script pages.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4746757#4746757
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4746757#4746757
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4746757#4746757. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver General by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • SQL * Loader help

    Dear All,
    I have installed a oracle database 9.2.at my home. And I want to use a sql loader.
    How should i invoke and use the sql loader.
    Please help in this regards.
    Thanks,
    Sid.

    This doc contains usefull info and examples:
    http://www.orafaq.com/wiki/SQL*Loader_FAQ

  • SQL Loader Help in 10g

    Hello,
    Is it possible to forcefully abort the sql loader when a value is not present? I've the data file like this
    1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX||2|
    5|XXX123|XXX|||
    9|XXX123|XXX|||
    Template:
    record type|batch number|batch desc|date|detail line num|others
    1,4,5,9 are the record types, if you see this line 5|XXX123|XXX||1| .. 1 represents a detail line number, My requirement is if the detail line number is null for record type 5 then I want to abort the sqlloader.
    Is it possible?
    Edited by: 940838 on Nov 21, 2012 11:54 PM

    940838 wrote:
    I think i am not clear in my requirement...
    The question was how to abort the loader if the detail line number is not present in record type 5. It is however normal that detail line num is not mandatory for other record types. any insights.Hi,
    you have been clear and I have made a quick test. Unfortunately you cannot do such check in SQL*Loader as the WHEN clause in control file does not allow any OR.
    Even if you add this check using a constraint in your table and specify the maximum number of errors to be 0, SQL*Loader will load the records up to that error.
    Let me show you an example:
    1) create the table with a constraint that for record_type 5 detail_line_number cannot be null.
    CREATE TABLE test
       record_type    INTEGER
    , batch_number   VARCHAR2 (10)
    , batch_desc     VARCHAR2 (10)
    , batch_date     DATE
    , detail_line_num INTEGER
    , other          VARCHAR2 (10)
    ALTER TABLE test
      ADD CONSTRAINT check_rec_5
         CHECK (   record_type = 5 AND detail_line_num IS NOT NULL
                OR record_type != 5) ENABLE;
                In this table you will not be able to load rows having record_type=5 and detail_line_num NULL as this will be considered as an error.
    Let's prepare your input file:
    1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX|||
    5|XXX123|XXX|||
    9|XXX123|XXX|||
    1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX||2|
    5|XXX123|XXX|||
    9|XXX123|XXX|||1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX||2|
    5|XXX123|XXX|||
    9|XXX123|XXX|||1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX||2|As you can see the input file has the fourth line with record_type = 5 and detail_line_num NULL. This will be an error for the constraint.
    Here the control file I have used:
    --test.ctl
    load data
    INFILE 'test.dat'
    APPEND
    INTO TABLE test
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS
    record_type     ,
    batch_number    ,
    batch_desc      ,
    batch_date      Date 'YYYYMMDD',
    detail_line_num ,
    other
    )If I try to execute the SQL*Loader and ask to stop at first error in this way:
    sqlldr userid=yourname/yourpass@yourdb control=test.ctl errors=0 rows=100SQL*Loader will load only 3 records because it encounters an error at line 4 and having specified errors=0 will not continue to load. Actually the process will continue until it reach the commit point (100 rows in this case) but it will not load any record after the error nor continue to read the file.
    So if I check the table
    SELECT * FROM test;
    RECORD_TYPE BATCH_NUMBER BATCH_DESC BATCH_DATE            DETAIL_LINE_NUM OTHER    
              1 XXX123       XXX        21-11-2012 00:00:00                            
              4 XXX123       XXX                                                       
              5 XXX123       XXX                                            1           You will see only records until you have reached the error.
    This cannot be avoided as documented in SQL*Loader reference manual:
    <h3>Load Discontinued Because Maximum Number of Errors Exceeded</h3>
    If the maximum number of errors is exceeded, SQL*Loader stops loading records into any table and the work done to that point is committed. As you can see SQL*Loader abort the processing but it will anyway commit the records until that error.
    One alternative solution is to create an external table in Oracle and do all the checks you want before copying your external table into a database table, as BluShadow suggested.
    Regards.
    Al

  • SQL Loader help requested

    Have a sqlloader job that is loading date columns into a table. Then the source of the data sends the wrong data '11000000' in the YYYYMMDD format and the load fails. Does anyone know how to make Oracle assume the null value in all cases when there is an invalid date (like 20060230, 20061131 in YYYYMMDD format)?
    We have used the nullif statement but it only works for known issues that are specified and we want it to work for all dates that are invalid.
    Thanks in advance.

    How about creating your own function and using that instead?
    http://groups.google.co.uk/group/comp.databases.oracle.misc/browse_thread/thread/a72362f8c32bdf21/ff350590a1fa7948?lnk=st&q=function+SQL*Loader&rnum=2&hl=en#ff350590a1fa7948

  • Oracle 11G Install on Win 7 With PL/SQL Developer Help Needed

    Today is my first day with Oracle. I have tried to Install Ora11g from our network drive.I think the installation went fine. I also installated PL/SQL Developer when i try to log in i got the following error see below.
    PL/SQL Developer - (Not logged on)
    Initialization error
    SQL*Net not properly installed
    OracleHomeKey: SOFTWARE\ORACLE
    OracleHomeDir:
    OK
    After i did some research online i found this solution "go to Tools > Preferences > options set manually "Oracle Home" to the folder of ORACLE_HOME and "OCI Library" to the oci.dll file located in ORACLE_HOME/bin/oci.dll"
    C:\app\user\product\11.2.0\client_1\bin.dll <=== I believe this is my Oracle_Home
    C:\app\user\product\11.2.0\client_1\bin\oci.dll <==== Is my OCI Library.
    When i apply thse 2 paths i get the following error.
    Initialization error
    COuld not load " C:\app\user\product\11.2.0\client_1\bin.dll
    OCIDLL forced to C:\app\user\product\11.2.0\client_1\bin.dll
    LoadLibrary(C:\app\user\product\11.2.0\client_1\bin\.dll)returned 0
    Can someone help me with this ???????????????/

    Pl indicate which version of Win 7 - you will need Professional or higher - Home versions are not supported/certified, so things may or may not work as expected.
    http://download.oracle.com/docs/cd/E11882_01/install.112/e16773/reqs.htm#CHDHGGFE
    HTH
    Srini

  • SQL Query Help Needed

    I'm having trouble with an SQL query. I've created a simple logon page wherein a user will enter their user name and password. The program will look in an Access database for the user name, sort it by Date/Time modified, and check to see if their password matches the most recent password. Unfortunately, the query returns no results. I'm absolutely certain that I'm doing the query correctly (I've imported it directly from my old VB6 code). Something simple is eluding me. Any help would be appreciated.
    private void LogOn() {
    //make sure that the user name/password is valid, then load the main menu
    try {
    //open the database connection
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:LawOffice2000", "", "");
    Statement select = con.createStatement();
    String strTemp = "Select * From EMPLOYEES Where INITIALS = '" + txtUserName.getText() + "' Order By DATE Desc, TIME Desc";
    ResultSet result = select.executeQuery(strTemp);
    while(result.next()) {
    if (txtPassword.getPassword().toString() == result.getString("Password")) {
    MenuMain.main();
    else {
    System.out.println("Password Bad");
    System.out.println(txtUserName.getText());
    System.out.println(result.getString("Password"));
    break; //exit loop
    //close the connection
    con.close(); }
    catch (Exception e) {
    System.out.println("LawOfficeSuite_LogOn: " + e);
    return; }
    }

    The problem is here: "txtPassword.getPassword().toString() == result.getString("Password"))"
    Don't confuse String's equals() method with the equality operator '=='. The == operator checks that two references refer to the same object. If you want to compare the contents of Strings (whether two strings contain the same characters), use equals(), e.g. if (str1.equals(str2))...
    Example:String s1 = "foo";
    String s2 = new String("foo");
    System.out.println("s1 == s2: " + (s1 == s2)); // false
    System.out.println("s1.equals(s2): " + (s1.equals(s2))); // trueFor more information, check out Comparison operators: equals() versus ==

  • SQL Report help needed

    Hi All,
    I am creating a report which is having 2 sql queries ,1 for the main columns that i need to show and 2 from total sum and count.
    Report is something as given below
    SET TAB OFF;
    set linesize 1500;
    set pagesize 50;
    SET FEEDBACK OFF;
    SET WRAP OFF
    COLUMN today NEW_VALUE VAR1 NOPRINT;
    TTITLE LEFT 'ABC Inc.' SKIP 1 -
    LEFT 'Daily Report' SKIP 1 -
    LEFT 'As Of ' VAR1 SKIP 2
    BTITLE LEFT SKIP 'Page No : ' FORMAT 9999999999 SQL.PNO SKIP 3;
    COL SR_NO HEADING 'Seq'               FORMAT 999999;
    COL REFNO HEADING 'Ref No'                FORMAT A20;
    COL ORIG_NAME HEADING ' Branch Name'      
         FORMAT A50;
    SELECT      ROWNUM                SR_NO,
         REF_NO                REFNO,
         ORIGIN_NAME               BRNAME
    FROM BANK
    WHERE PASS_CD=101
    SELECT      ' Failure Count : '|| NVL(COUNT(DECODE(CODE,1,CODE,NULL)),0) ||
         ' Failure Total Amt : '|| NVL(SUM(DECODE(CODE,799,AMT,NULL)),0)
         || CHR(10) ||     
         ' Successful Count : '|| NVL(COUNT(DECODE(CODE,000,CODE,NULL)),0) ||
    ' Successful Total Amt: '|| NVL(SUM(DECODE(CODE,000,AMT,NULL)),0)
    FROM BANK;
    CLEAR BREAKS;
    CLEAR COLUMN;
    TTITLE OFF;
    When i am running this second query output is going to secong page and title is repeated again and same as 1rst page is showing page no-1
    Kindly help me,i want the output on the same page at bottom.
    Thanks

    i think its only work in ISQL* PLUS enivironment iam
    not sure.It does work in SQL*Plus
    is that i can use in the package??http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12048.htm

  • How to optimize this SQL. Help needed.

    Hi All,
    Can you please help with this SQL:
    SELECT /*+ INDEX(zl1 zipcode_lat1) */
    zl2.zipcode as zipcode,l.location_id as location_id,
    sqrt(POWER((69.1 * ((zl2.latitude*57.295779513082320876798154814105) - (zl1.latitude*57.295779513082320876798154814105))),2) + POWER((69.1 * ((zl2.longitude*57.295779513082320876798154814105) - (zl1.longitude*57.295779513082320876798154814105)) * cos((zl1.latitude*57.295779513082320876798154814105)/57.3)),2)) as distance
    FROM location_atao l, zipcode_atao zl1, client c, zipcode_atao zl2
    WHERE zl1.zipcode = l.zipcode
    AND l.client_id = c.client_id
    AND c.client_id = 306363
    And l.appType = 'HOURLY'
    and c.milessearchzipcode >= sqrt(POWER((69.1 * ((zl2.latitude*57.295779513082320876798154814105) - (zl1.latitude*57.295779513082320876798154814105))),2) + POWER((69.1 * ((zl2.longitude*57.295779513082320876798154814105) - (zl1.longitude*57.295779513082320876798154814105)) * cos((zl1.latitude*57.295779513082320876798154814105)/57.3)),2))
    I tried to optimize it by adding country column in zipcode_atao table. So that we can limit the search in zipcode_atao table based on country.
    Any other suggestions.
    Thanks

    Welcome to the forum.
    Please follow the instructions given in this thread:
    How to post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting
    and add the nessecary details we need to your thread.
    Depending on your database version (the result of: select * from v$version; ):
    Have you tried running the query without the index-hint?
    Are your table (and index) statatistics up-to-date?

  • System won't load (help needed)

    Hello!
    I have a PIII 600 computer which I don't really need, but I decided to make any use of it with Archlinux. The problem is that even before I cleared my hard drive, the only thing I had been able to load on it was Windows ME in a safe mode (I don't know if that's the correct name for this mode, as I was using Polish language version).
    But I managed to run the Arch installer using acpi=off option. Now, when I turn the computer on, I can see the Grub menu, but no matter what I choose, the system stops loading and just does nothing. I had the same sympthom when I used the installer without acpi=off option (or with any other).
    Can anybody tell me, what kind of problem (I guess it's my hardware) do I have? Is there a way to run the system I have installed right now, maybe using command line in Grub?
    Some additional info: I have 128MB SDRAM DIMM (Windows was saying it was 126, but my bios finds more than 131 000 bytes), SoundBlaster 128, nVidia Riva TNT2, 17-inch LCD working at 1280x1024, a PCI wifi card, a radio ISA card. I can't run Archie nor memtest.
    Thanks in advance for any ideas.

    Wiki is your friend - http://wiki.archlinux.org/index.php/Main_Page
    I do not mean to be mean, it's simply inefficient to try and answer all the questions you _will_ have while trying to configure Arch to your liking, especially since Wiki covers most of them, and covers them well.  If you come across a problem that's not covered in the wiki post here and we will definitely try and help you

  • SQL problem - help needed ASAP!!

    Hey guys,
    Doing a college project... would really appreciate some help. I am trying to use a variable in the where clause of a select cursor in PL/SQL. The code is this:
    procedure results(p_search_entry varchar2, p_search_field varchar2) is
    cursor c_results is
    select * from physics_b where p_search_field = p_search_entry;
    begin
    for cv_results in c_results
    loop
    -- loop through actions
    end loop;
    The problem is that I don't know how to get the where clause to accept the variable passed into the procedure as the field name. Does anyone know the syntax for this?
    Thanks very much!
    Niall

    This isn't the correct forum for this kind of question. The SQL and PL/SQL forum PL/SQL is probably best.
    That said, you can't do what you want that way.
    You can do
    procedure results (p_search_entry in varchar2)
    cursor c_result is
    select * fro physics_b where subject=p_search_entry;(assuming subject is a column in physics_b)
    You can't use a variable to represent a column directly. You need to build the statement as a string and then use execute immediate.
    statement:='select * fro physics_b where '||p_search_field||' = :1';
    -- this bit is probably bad syntax.
    execute immediate statement using p_search_entry;Look up execute immediate and bind variables

  • SQL Syntax - help needed

    Guys,
    Help me understand the syntax please!! With PL/SQL I have achieved a task quite easily, with a branch of code to include or exclude some part of the query - no problem. But to use SQL ......
    If i have a variable on a page, say :p10_open_or_closed
    .. and I set the value of this to the text "Is Not Null"
    How can I incorporate this into an SQL query, say
    Select ID, Date1, Date2, Comment
    From Table1
    where Date1 Is Not Null
    Is there a way of substituting the ":p10_open_or_closed" variable into this query?
    ie
    Select ID, Date1, Date2, Comment
    From Table1
    where Date1 ":p10_open_or_closed"
    Thanks.

    Thanks for your help gents.
    Originally, I had a PL/SQL Statement constructing the code as needed, as Rekha
    suggested.
    if :P1_OPEN_OR_CLOSED = 1 then
    q:=q||' and ';
    q:=q||' p.ACTUAL_INSTALL_DATE is null ';
    end if;
    if :P1_OPEN_OR_CLOSED = 2 then
    q:=q||' and ';
    q:=q||' p.ACTUAL_INSTALL_DATE is not null ';
    end if;
    But, to use a Tabular form, where users can update fields of multiple records on screen then submit for a MRU, the option of PL/SQL code is not allowed, only SQL. So Phil UK, no it's not an elegant way of doing things, but I'm forced to use SQL, yeah?
    There are definitely ways that I can filter for the solution I am after, but they all involve more in depth solutions (that are not that great). Thus, I asked at this forum.
    Andy, your solution works :~) which makes me very happy. I'm not sure how just now but I'll learn from it.
    Thanks again.

  • SQL Filter Help Needed

    Hello,
    I am in need of some SQL help as I am not sure how to do it.  I want to only return rows of data that meet the following criteria:
    1) in tableA columnA it could have a value shown as such:  A,B,1,2,3,5,8
    2) in tableA columnB it shows one of the following four variables (Test1, Test2, Test3, Test4)
    3) in tableA columnC it will show a date.
    4) in tableB there is a row for each day of the year. 
    5) in tableB there is a column that matches each of the four variables in #2 above. 
    First it should match the date in tableA ColumnC to the row in tableB that matches.  Then it should then find the column in tableB that matches to the value in tableA columnB.  in that cell it will have a single value from A-D or 1-9.  If it is an A for example, it will need to check against tableA columnA.  if it has an A in it, it will return it.  If it does not, it will not.  
    Does anyone have any idea how to write this?  Is this possible?
    Thank you,
    Jeff

    Check the query using hardcoded values first - values taken from your explication
    select x.idfield
      from tablea x,
           (select datedefinefield,
                   'VARIABLE4' the_variable,
                   case 'VARIABLE4' when 'VARIABLE1'
                                      then variable1
                                      when 'VARIABLE2'
                                      then variable2
                                      when 'VARIABLE3'
                                      then variable3
                                      when 'VARIABLE4'
                                      then variable4
                   end the_value
              from tableb
             where datedefinefield = date '2013-01-01'
           ) y
    where x.datefield = y.datedefinefield
       and x.variablefield = y.the_variable
       and instr(','||x.codefield||',',','||y.the_value||',') > 0
    then replace the hardcoded values with bind variables
    select x.idfield
      from tablea x,
           (select datedefinefield,
                   :the_variable the_variable,
                   case :the_variable when 'VARIABLE1'
                                      then variable1
                                      when 'VARIABLE2'
                                      then variable2
                                      when 'VARIABLE3'
                                      then variable3
                                      when 'VARIABLE4'
                                      then variable4
                   end the_value
              from tableb
             where datedefinefield = to_date(:the_date,'yyyymmdd')
           ) y
    where x.datefield = y.datedefinefield
       and x.variablefield = y.the_variable
       and instr(','||x.codefield||',',','||y.the_value||',') > 0
    type the values in the window SQL Developer displays before execution to prompt you for bind variable values
    VARIABLE4 for the_variable
    20130101 for the_date
    no quotes this time then hit the Apply ( not very sure that's the caption) button to start execution and you should get the same result as with hardcoded values.
    If that works, you can start playing with (submitting values of your choice)
    Regards
    Etbin

  • SQL queries help need-urgent

    Based on your inputs-I studied and created the below objects.I apologise for asking lengthy questions,but i
    need your help very much now to proceed next.
    There is a COMPANY WHICH has many divisions/departments in it.
    These divisions has employees.
    *{color:#0000ff}--Created employee table which employee_id and Salary.*
    **employees (*empid,salary){color}*
    *{color:#0000ff}***DO i need to put the DEPT_ID and Manager_id in the EMPLOYEES table? {color}*
    *{color:#0000ff}--Presently,iCreated a relationship table to have EMPLOYEE"S MANAGER information.a manager is an employee itself.{color}*
    *{color:#0000ff}--Created a table for EMPLOyee and department---RELATIONSHIP ---&gt; empl_id and dept_id{color}*
    The COMPANY has numerous Products(also we can say projects) and these project work is done by the various depts.
    *{color:#0000ff}Projects /Job table*
    *--job_id*
    *--Project_name*
    *--Budget Amount{color}*
    *{color:#0000ff}--Created a table for Project and department---RELATIONSHIP ---&gt; proj_id and dept_id*
    *--Also,Created a table for Project and Employee---RELATIONSHIP ---&gt; proj_id and employee_id{color}*
    Also,here scenario (1)Employees can work or be a part of many or multiple departments and work for multiple projects/products at a time (2)As usual-each Department has a manager.**EVery dept can handle or work only on one project.
    *{color:#0000ff}--Created a table for Project and department---RELATIONSHIP ---&gt; proj_id and dept_id*
    *--Also,Created a table for Project and Employee---RELATIONSHIP ---&gt; proj_id and employee_id*
    *{color}*
    _*{color:#000000}***(1)Are the tables and the relationships defined above enough or have i created too much tables?Please advise me.{color}*_
    Queries:-Need to write SQLs for below items.Please help me.Could you all have a look
    bq. h5. {color:#0000ff} \\ _     (2)SQL for a person see all his manager?***A person can have 2,3 managers._ \\ _     (3)need a person---&gt;manager--&gt;and their manager's MANAGER_ \\ _     (4)How will managers to view all employees reporting to him._ \\ {color} \\ h5. \\ {color:#0000ff}_(5)feasibility (SQL) to support the increase of salaries of employees in a department by percentage or amount wise._ \\ _     (6)SQL to update or change manager of a department/employee._ \\ {color} \\ h5. \\ {color:#0000ff}_(7)If a employee is removed-then all related details should also be removed._ \\ _     (8)to remove person and department,terminate a person from organisation_ \\ _     SHIFTING a person to different department,assign a person to a department_{color} \\ h5. {color:#0000ff}_SQL to collect all info of a person, his managers , departments and project this employee works._ \\ _     find Department which dont have managers._{color} \\ h5. \\ {color:#0000ff}_****find expenditure all projects together in terms of salary_{color}

    Sorry for all the confusion with the questions.So let me clear myself,i am doing this not as assignment or homework,but something
    which interests me and trying to leran.Earlier as I stated that its a part of my school(** well frnakly speaking, it was my plan if i could
    put this as an item of the school as the scope is very huge.
    *(1)one employee can be in many departments(1 TO MANY) and and each department has one manager.(1 to 1)*
    Created a table for EMPLOyee and department-RELATIONSHIP ---&gt; empl_id and dept_id*
    (2)Also,an employee can work in multiple items/projects(1-MANY) at a time. And a project HAS only one department.(1 to 1)
    **Projects table created has codes,the Project name ,Planned budget cost/amount, start_date and end_date AND DEPART_ID
    Also,Created a table for Project and Employee-RELATIONSHIP ---&gt; proj_id and employee_id*
    This is the full scenario has put above.So,i needed help as I am very confused if i have done the correct relationships.
    And,these below items are my plans to allow the schema nd tables support it.
    (2)how will a person see all his manager?***A person can have 2,3 managers.(EMP-&gt;MANAGER relationship TABLE)
    (3)SQL to be able to show a person---&gt;manager--&gt;and their manager's MANAGER
    (4)How will managers to view all employees reporting to him.
    (5)SQL to support the increase of salaries of employees in a department by percentage or amount wise.
    (6)SQL to update or change manager of a department/employee.
    (7)If a employee is removed-then all related details should also be removed.
    (8)to remove person and department,terminate a person from organisation
    SHIFTING a person to different department,assign a person to a department
    Projects /Job table EMPLOYEES TABLE-&gt; SALARY info
    --job_id
    --Project_name
    --Budget Amount

Maybe you are looking for