Can I Insert fixed string in table select table data found?

Hi all
I have a table
Create table student (student_name varchar2(10), student_id number(10),day varchar2(10),hours_studied number(10));
 
insert into student values ('RON',12,'SUN',4);
insert into student values ('RON',12,'MON',5);
insert into student values ('RON',12,'TUE',6);
insert into student values ('ZAP',13,'SUN',3);
insert into student values ('ZAP',13,'MON',9);
insert into student values ('ZAP',13,'TUE',10);
insert into student values ('DEW',14,'SUN',4);
insert into student values ('DEW',14,'MON',6);
insert into student values ('DEW',14,'TUE',8);
insert into student values ('PIKE',15,'SUN',2);
insert into student values ('PIKE',15,'MON',1);
insert into student values ('PIKE',15,'TUE',4);
insert into student values ('TON',16,'SUN',30);
insert into student values ('TON',16,'MON',2);
insert into student values ('TON',16,'TUE',24);
I have one more same table as before, but with an extra column
Create table student1 (student_name varchar2(10), student_id number(10),day varchar2(10),hours_studied number(10)) month varchar2(10);
Now, I want to insert data into the table 'student1' using the 'student', which includes the data.
Insert into student1 values select * from student
The above insert statement throws me an error "Not enough values" something like that...


There is no primary key on the table. I last column of the table, "Student" 1 is standard, that is to say.., MAY for all lines.
Can I write the query like this?
Insert into student1 values select student_name,student_id,day,hours_studied,'MAY' from student;
If this is not the case, how can I write the insert statement?

Please let me know if it's confusing...

Yes, it works, but need a correction of bit:

Insertion in Student 1 select student_name, student_id, day, hours_studied, 'USA' of student

you do not have the keyword "VALUES" in the "insert... Select...' statement."

Tags: Database

Similar Questions

  • can I insert a column of table in mysql?

    Hello

    I have a long column of table of numbers. I use labsql to connect to mysql.

    When I was a number, I change my channel number and then concatenate it with commands insert to insert my mysql table number.

    now, I want to insert a long column of numbers to mysql, but it is difficult. because for there needs to like before.

    can I insert this table in the form of lots and without recourse to a 'for' and as fast as possible?

    Best regards


  • How can I insert a n-dimensional table using Insert table subset?

    I am able to insert a row or a column in the table. But how do I insert a table 2D or 3D in an existing table?

    Kind regards

    Adel SR

    Just it wire in.  Here is a 2D chart inserted into a 3D (at the beginning of the 3D table)...

    BS

  • Cannot get the "< FEFF >" string in the selected text [indesign CS6]

    Hello world!

    I can't get the string to the selected text. The selected text contains several xml tags.

    In adobe indesign cc version of 2014, the selected text is bring the string «< FEFF >» tags

    In indesign adobe cs6 version cannot get the string "< FEFF >. they do ""-empty space.

    Screen Shot 2015-09-23 at 6.01.25 PM.png

    Are the above-selected text contains several xml tags.

    but I get content using script code can't get the string.

    Screen Shot 2015-09-23 at 6.02.51 PM.png

    the script gives the result, xml tags are converted to "". ""  I expect "< FEFF >.

    I expect the output is: "< FEFF > Applescript < FEFF > < FEFF > selected text < FEFF > < FEFF > < FEFF >."

    Please help me...

    Thank you

    John Peter.

    the script gives the result, xml tags are converted to "". ""  I expect to ''.

    The xml tags are not converted to "" but "\uFEFF" (zero-width space non-bec), it is the character used to represent the tags in a text frame. Looks like the apple script converts a hexadecimal representation unicode values.

  • Please how can I insert a value of richinputtext in the database string attribute

    Please how can I insert a value of richinputtext in the database string attribute

    If you can get its value at the bean and then call your insert statement to put it in the DB table

    and if you want to know about the execution of SQL query

    then check - Ashish Awasthi (Jdev/ADF) Blog: SQL to run in an ADF Application using DataSource DBTransaction & JDBC query

    Ashish

  • Can I use shrink for an asset (perform insert very-delete operations) table

    Hello guys,.

    I have a very simple question. According to an article (link: http://www.dba-oracle.com/t_automatic_segment_space_management.htm) the following quote is written
    Beware:  Using ASSM can hinder database DML performance, and most Oracle experts will use manual freelists and freelist groups.  Click here for details on automatic segment space management internals.
    
    Using automatic segment space management is great for almost all Oracle applications, with the exception being super-high update tablespaces, which would use traditional freelists with multiple freelist groups.
    I just want to use shrink my table in order to reclaim the unused space. However, I play a lot insert and delete operations on the table (not update, insert and delete). So, I wonder, if I use shrink, my table will affect seriously? Because I insert and remove thousands of rows in this table every day.


    And my second question is how can I know that my table is in SAMS (automatic segment space management) to use retractable? Because I was told that my table shoul be in SAMS to use retractable?
    select * from v$version;
    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE 11.2.0.1.0 Production."
    AMT for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    best regards
    Charlie

    970992 wrote:
    I just want to use shrink my table in order to reclaim the unused space.

    Ok. You are sure that there is some unused space and that Oracle will not reuse space automatically? If you are constantly inserting and removing a table, unless you remove constantly more data that you insert or you use direct-path inserts to prevent Oracle to reuse the space freed by deletions, there is no reason to believe that there is unused space in the table.

    However, I play a lot insert and delete operations on the table (not update, insert and delete). So, I wonder, if I use shrink, my table will affect seriously? Because I insert and remove thousands of rows in this table every day.

    Thousands of lines is enough little activity.

    If you want to shrink the table, you generally want to do while there is little or no activity on the table since you will need to at least briefly to acquire a lock on the table. If you do only a few thousand a day race DML operations, it shouldn't be difficult to find a window where the shrink will not be a significant impact on DML.

    But, back to my first point, I would tend to wait that you don't need to shrink the table in the first place.

    And my second question is how can I know that my table is in SAMS (automatic segment space management) to use retractable? Because I was told that my table shoul be in SAMS to use retractable?

    Assuming that you know what the table tablespace is in

    SELECT segment_space_management
      FROM dba_tablespaces
     WHERE tablespace_name = <>
    

    Justin

  • Select values from the db1 table and insert into the DB2 table

    Hello

    I have three databases oracle running in three different machines. their ip address is different. among the DB can access databases. (means am able to select values and insert values into tables individually.)

    I need to extract data from the DB1 table (ip say DB1 is 10.10.10.10 and the user is DB1user and the table is DB1user_table) and insert the values into DB2 table (say ip DB2 is 11.11.11.11 and the user is DB2user and table DB2user_table) of DB3 that is to have access to the two IPs DB.

    How do I do this

    Edited by: Aemunathan on February 10, 2010 23:12

    Depending on the amount of data must be moved between DB1 and DB2, and the frequency at which this should happen, you might consider the SQL * COPY more control. I think it's very useful for one-off tasks little, so I can live within its limits of the data type. More http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/apb.htm#i641251.

    Change some parameter of sqlplus session are almost mandatory in order to get decent transfer rates. Tuning ARRAYSIZE and COPYCOMMIT can make a huge difference in flow. LONG change may be necessary, too, depending on your data. The documentation offers these notes on use:

    To activate the copy of data between Oracle and databases non-Oracle, NUMBER of columns is replaced by DECIMAL columns in the destination table. Therefore, if you are copying between Oracle databases, a NUMBER column with no precision will become a DECIMAL column (38). When copying between Oracle databases, you must use SQL commands (CREATE TABLE AS and INSERTION), or you must make sure that your columns have a specified precision.

    SQL * the VALUE LONGER variable limits the length of the LONG column you are copying. If all LONG columns contain data exceeds the value of LONG, COPY truncates the data.

    SQL * Plus performs a validation at the end of each successful COPY. If you set the SQL * variable more COPYCOMMIT DEFINED to a value positive n, SQL * Plus performs a validation after copying all lots n of records. The SQL * Plus ARRAYSIZE variable SET determines the size of a batch.

    Some operating environments require that the service names be placed between double quotes.

    From a SQL * Plus term on DB3, can resemble the command to move all content from my_table in DB1 to the same table in DB2

    COPY from user1/pass1@DB1 to user2/pass2@DB2 -
    INSERT INTO my_table -
    USING select * from my_table
    

    Note the SQL code * more line-continuation character ' - '. It is used to escape the newline character in a SQL * Plus command if you do not have to type all on one line. I use it all the time with this command, but I can't locate the documentation on that right now. Maybe someone else can put their finger on it.

    There are other ways to accomplish what the command copy and it is not without its quirks and limitations, but I find that there is usefulness in an Oracle Toolbox.

  • How is it, I can't insert into table inside the function?

    If I have a simple function that takes the same data with SELECT... IN... and then the information I need to insert back to the same table, but the error message says I can't insert, update, delete on a table I'm working on, but I understand that is SELECT... Will be actually copy the data from a select query in these variables that I use in my SQL function. So why, after completing Select I can't update in my SELECT stopped working already on the table.

    Procedures may not be called from a SQL statement.

    However, you can [call procedures PHP | http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_sps.html].

    Justin

  • How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    What is the formula?

    You can do this with a column of "index" in table 1, as this assistance:

    The formula in C2, filled to the bottom:

    IF (B =<>

    That increments a counter each time that it finds a negative number in column B.

    In the second table, you can retrieve a list of negative values in this way:

    The formula in A2, filled to the bottom:

    = INDEX (array 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0))

    It takes the line number, the formula is activated, subtracts 1 to the header line and look up the result in the column of table 1 C.  If it finds a match, it feeds the line number to the INDEX page with retrieves the value of the column of table 1A.

    To hide the red triangles of signage wrap the IFERROR formula, like this:

    = SIERREUR (INDEX (table 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0)),"")

    Of course, you can also simply filter on column B without the need to set up a column from another table or index.

    SG

  • How can I insert a table created in Excel on the Web in Adobe Muse [was: Hello,]

    Hello

    I have a question, How can I Insert a table with features created in Excel for the Web in Adobe Muse.

    Thank you A. Fischer

    That is right. It is most likely will not get a glimpse. You may need to check in a real browser.

  • How can I insert several CSVs in dreamweaver in a table based on ID

    How can I insert several CSVs in dreamweaver in a table based on ID? I recorded each sheet in the doc excel as a CSV file and now I want to import all the CSVs in one table by pulling the information attached to the ID of the line.

  • How can I insert space in a long page? Say, 1000px. Without selection and dragging everything down.

    Let's say I have a portfolio page and around 1500px from the top I want to insert 4 new fotos. I've been going to the bottom of the page and click-drag-ability to select all the fotos and pulling them down.

    Can I insert a space at a certain time and have everything go down accordingly?

    Thank you!

    Anthony

    You must physically move in the place. This is not a desktop program where you can specify line spacing, think of it as a blank canvas.

  • The table layout where the new line can be inserted / updated rest is read only

    Jdev Studio Edition Version 11.1.1.3.0.

    I have a (JSF) page that has table. My requirement is I need make the line as read only with the exception of the newline (created with the new button) as update / insert able. Please suggest a way around so that the user can only add records to the table but couldn't change all existing records in the table.

    Please advice.
    Thank you.

    S Chatterji.

    S. Chatterji,

    If you are using ADF business components, just go to the VO on which is based the table and brand every attribute as "Editable when new" only.

    John

  • How can I insert commas in a string to a number?

    Here's the process I use to

    generates a numeric string in an Acrobat form:

    var A = this.getField("fieldname").value * 1000000000
    var B = this.getField("fieldname").value * 1000000000
    var C = this.getField("fieldname").value * 1000000000
    var D = this.getField("fieldname").value * 1000000000
    var E = this.getField("fieldname").value * 1000000000
    var F = this.getField("fieldname").value * 1000000
    var G = this.getField("fieldname").value * 1000000
    var H = this.getField("fieldname").value * 1000000
    var I = this.getField("fieldname").value * 1000000
    var J = this.getField("fieldname").value * 1000000
    var K = this.getField("fieldname").value * 1000
    var L = this.getField("fieldname").value * 1000
    var M = this.getField("fieldname").value * 1000
    var N = this.getField("fieldname").value * 1000
    var O = this.getField("fieldname").value * 1000
    var str = A - B - C - D - E + F - G - H - I - J + K - L - M - N - O

    For example, the resulting string is: How can I insert commas so the chain will read from 237036054000: 237,036,054,000?

    The number string is not always the same length so I need to add commas to the right. For example, the number may be: 7,234,887,000 or 124,345,000. The only constant is that the numbers will end in "000" as there are no hundreds in the sequence, I work with.

    I have to add commas to the strobila, so I can break the string up in the same type of components that I started with. I already part, but I need to insert commas as a separator for the second half of work.

    Thanks much for any help you can offer.

    Steve

    What is a custom calculation script? If so, do you have to checked to make sure that the field calculation order is correct?

  • Tables: How can I insert "(continued)" in the legends of the table?

    Hello

    I have a document with a number of tables that break across pages. How can I insert the word '(continued)' in the caption of the table on pages of second and followed by a table?

    Advice appreciated.

    See you soon

    Use the variable table Continuation (special > Variables) to insert it.

Maybe you are looking for

  • DeskJet 990cxi: getting deskjet 990cxi to software to work on 64-bit windows 10 HPZ230

    I have a new HP X 230 10 64-bit windows desktop pc. I tried to install the software for my hp deskjet 990cxi and I get an error message saying that it is not compatible with 64 bit. Y at - he no download available to make it compatible so that I can

  • Update of Microsoft using large amounts of resources

    I have 2 computers with Microsoft update by using a large amount of RAM.  Wuauclt.exe and svchost.exe eat so much memory that do not complete the updates.  This happened for a few weeks and have just been told.  I have reset the updates that did not

  • Live to fill out PDF forms

    I made a form in InDesign and converted to PDF using Adobe Acrobat 9 Pro and a form to fill out. I placed the form on-line on our Web site for members to fill out and return by e-mail when you click on the submit button. This works fine on a Mac, but

  • M2NC51-AR mother BIOS Update that can be run on win7 64 bit?

    Hello I have a hp slimline s3040.uk with a staggering M2NC51-AR, otherwise known as the mailisn't of the ASUS M2NC51-AR HematiteXL-GL8E HP This motherboard has been replaced twice, but my problem is when the pc goes to sleep he would not wake up easi

  • Where can I find my license key in Lightroom?

    I bought a full version of Lightroom 5 online about 5 weeks ago. Everything was fine until the develop module stopped working last night and I now get a message 'module disabled development - necessary renewal. " I would check that my license key is