Sql updating table from same table
PDF (US Ltr) - 46.7Mb PDF (A4) - 46.8Mb PDF (RPM) - 42.2Mb HTML Download (TGZ) - 10.8Mb HTML Download (Zip) - 10.8Mb HTML Download (RPM) - 9.3Mb Man Pages (TGZ) - 224.9Kb Man Pages (Zip) - 330.3Kb Info (Gzip) - 4.2Mb Info (Zip) - 4.2Mb My SQL Backup and Recovery My SQL Globalization My SQL Information Schema My SQL Installation Guide Security in My SQL Starting and Stopping My SQL My SQL and Linux/Unix My SQL and Windows My SQL and OS X My SQL and Solaris Building My SQL from Source My SQL Restrictions and Limitations My SQL Partitioning My SQL Secure Deployment Guide My SQL Tutorial My SQL Performance Schema My SQL Replication Using the My SQL Yum Repository option as part of a table reference.
Simply follow the INSERT statement with a query that returns the desired rows.
For tables with a mix of default and non-default columns, inserting default values for a column is as easy as excluding the column from the insert list; you do not need to use the DEFAULT keyword.
Say that table D had an additional column that was not defined with a default value: Not everyone realizes that you can explicitly specify NULL in the values list of an INSERT statement.
That may not sound like too useful a thing now, but the MERGE statement represents a very powerful way to bring a database table into sync with an external source of data (such as a flat file feed from a remote system). The value for DEPTNO should be 50, DNAME should be “PROGRAMMING”, and LOC should be “BALTIMORE”.
The INSERT statement allows you to create new rows in database tables.
The query may be complex or simple, but ultimately you want the result to be inserted into another table.