How can an SQL statement read the data in a table one by one?

Updated on technology 2024-05-12
18 answers
  1. Anonymous users2024-02-10

    into select statement.

    The form of the statement is insert into table2(field1,field2,..select value1,value2,..from table1

    The destination table 2 must exist, and since the destination table 2 already exists, you can insert constants in addition to the fields in the source table 1.

    into from statement.

    The statement is in the form of: select vale1, value2 into table2 from table1

    The target table table2 does not exist, because table table 2 is automatically created when inserted, and the data of the specified fields in table 1 is copied to table 2.

  2. Anonymous users2024-02-09

    With a cursor, you look up the book and see how to use it.

  3. Anonymous users2024-02-08

    Use the query statement select * from user where id=1

    I don't know if your username refers to a field, if you want to get out the value of a field in the table, you can use the select field name 1, field name 2 ...from user where id=1

  4. Anonymous users2024-02-07

    select username from user where id=1

    There are also many database help classes on the Internet, which have more convenient ways to write.

    Hope the answer satisfies you.

  5. Anonymous users2024-02-06

    Do you want to get the displayed data, or do you want to create a new table from it. It seems that you can use multiple tables to associate it, or you can use a view to store the processed data in the view.

  6. Anonymous users2024-02-05

    Query insertion select into (the key is what you do).

  7. Anonymous users2024-02-04

    1. Copy the data from the old table to the new table (assuming that the structure of the two tables is the same).

    insert into the new table select * from the old table.

    2. Copy the data from the old table to the new table (assuming that the structure of the two tables is different).

    insert into the new table (Field 1, Field 2,..select Field 1, Field 2 ,..from Old Table.

    3. Copy the table structure and data to the new table.

    select * into the target table name from the source table name (requires that the target table does not exist because it is automatically created when inserted).

    4. Copy only the table structure to the new table.

    create table The new table select * from the old table where 1=2 is: let the where condition not be true.

  8. Anonymous users2024-02-03

    SQL Server, if the target table exists:

    insert into the destination table select * from the original table;

    SQL Server, if the target table does not exist:

    select * into the destination table from the original table;

    oracle, if the target table exists:

    insert into the destination table select * from the original table;

    commit;

    In Oracle, if the target table does not exist:

    create table destination table as select * from original table;

  9. Anonymous users2024-02-02

    How to copy the data of one table to another table is because the data of this table is almost useless.

    Copy to another table.

  10. Anonymous users2024-02-01

    Copy the table structure and data to the new table select * into the destination table name from the source table name (the target table does not exist because it is automatically created when inserted).

    Step to read. 2. Copy the schema of the table to the new table create table The new table select * from the old table where 1=2 is: let the where condition not be true.

    Step to read. 3. Copy the data of the old table to the new table (assuming the structure of the two tables is the same) insert into the new table select * from the old table.

    Step to read. 4. Copy the data from the old table to the new table (assuming that the structure of the two tables is different) and insert into the new table (Field 1, Field 2, ,..).select Field 1, Field 2 ,..from Old Table.

    Step to read. 5Oracle databases are similar.

  11. Anonymous users2024-01-31

    How does a language copy data from one table to another? Copy and paste.

  12. Anonymous users2024-01-30

    If you already have a data table in SQL statement, you want to copy a data table that belongs to you. Yes:

    create table new table as select * from old table;

    Example: There is already a **:select * from

    student

    Student Sheet) Copy a copy of the Student Sheet:

    create table

    student_oneas select * from

    student

  13. Anonymous users2024-01-29

    inset into table (field 1, field 2) select field 1, field 2 from table 2

  14. Anonymous users2024-01-28

    To be clear, whether to update the contents of one table to another or insert it into another, or to update to...set

    When inserting, use insert .into

  15. Anonymous users2024-01-27

    What database do you use?

    Oracle MySQL is it.

    create table t_a as select * from t_b;

    Create a table t a that is the same as t b.

  16. Anonymous users2024-01-26

    First, create a dynamic array, read the data through the SQL statement and send it to the dynamic array, then use the SQL statement to create a new data table, and finally insert the values in the array into the new table.

    What program are you going to use to write it?

  17. Anonymous users2024-01-25

    Copy the table structure and data to the new table.

    Create table New table Select * from old table Insert into new table (select * from old table) provided that the table structure is the same.

  18. Anonymous users2024-01-24

    What do you mean? By the program or...

    select id,name into test2 from test1

Related questions
11 answers2024-05-12

In the deleted table of the trigger, the deleted row is saved. Just take it out and insert another table. >>>More

12 answers2024-05-12

Each table in a database can have only one primary key, and it is not possible to have multiple primary keys. >>>More

4 answers2024-05-12

Typical steps regarding the design of permissions.

1. In the user table, there is a field in the user table that records the role number in the role table. >>>More

2 answers2024-05-12

sql2000

In the start-program-microsoftsqlserver-enterprise manager interface, open the console root file and record all the numbers to (local) (windowsnt), which has the database, data conversion service. Wait, you can right-click "New Database" in "Database" and you're done. >>>More

16 answers2024-05-12

If you're a bold girl, you should always confess to him.

If you are a shy girl, when you usually get along with him, hint at him intentionally or unintentionally, let him understand that you like him, and you can also let your friends joke when we usually chat together, saying that you like that boy, and then, deliberately want to make do with the two of you, if that boy likes you, maybe in this case, he will come to chase you, hehe. >>>More