The SQL statement is: SELECT * FROM table1 where ' text ' like CONCAT ('% ', (select name from table2 where ID =3), '% ');UPDATE ecs_region a,nation b SET a.code = B.code where b.province like concat ('% ', a.region_name, '% ');UPDATE ecs_region a,nation b SET a.code = B.code where b.city like concat ('% ', a.region_name, '% ');
changed rows. The MySQL_info () c api function returns the number of matched and updated rows and the number of warnings generated during the UPDATE process.
You can use LIMIT row_count to LIMIT the UPDATE range. The LIMIT clause is a LIMIT for matching rows. As long as the
For simpler tables, the amount of data is not a very much table, you can use a simple SQL statement to back up
CREATE TABLE t_fa_cat_20121207 as SELECT * from T_fa_cat
Create a new table and save the data
INSERT INTO T_fa_cat select * from t_fa_cat_20121207
To import the original backed-up data into a table to recover data
How to update multiple fields
When multiple timestamp are present in a table and one is set to Current_timestamp, you often encounter#1293-incorrect table definition; There can is only onetimestamp column with Current_timestamp in DEFAULT or on UpdateclauseThe reason is that when you set the timestamp to on Updatecurrent_timestamp, the other timestamp fields need to explicitly set the default valueBut if you have two timestamp fields, but only the first one is set to Current_times
, and I have a difference before using the notation. But the method is better understood than the notation.#include #include#definell Long Long#defineMAXN 800010#defineLson l,m,rt#defineRson m+1,r,rtusing namespacestd;intn,m;ll mi;Charp[Ten];structnode{ll Sum,mi;} T[MAXN];voidPushup (intRT) {T[rt].sum=t[rt1].sum+t[rt1|1].sum; T[RT].MI=min (t[rt1].mi,t[rt1|1].mi);}voidBuildintLintRintRT) { //t[rt].lazy=0; if(l==R) {scanf ("%lld",T[RT].MI); T[rt].sum=T[RT].MI;return; } intM= (l+r) >>1;
Tags: Execute SQL query to modify update multiline recordTypically, we use the following SQL statement to update field values:UPDATE mytable SET myfield= ' value ' WHERE other_field= ' other_value '; UPDATE mytable SET myfield= ' value ' WHERE other_field= ' other_value ';Bu
There are times when we need to update data from multiple tables and then we need to use the following methods:
(1) SQLite multiple table Update method
Copy Code code as follows:
//----------------------------------
Update T1 set Col1=t2.col1
from table
SQL Server concurrent processing, update solution discussion, SQL Server
Preface
In this section, we will talk about the most common situation of concurrency, that is, update. If no row record exists in concurrency, insert it. At this time, it is very easy to insert duplicate keys, this article describes the seven solu
SQL statement: Way One
Copy Code code as follows:
Public list{
Use using a flexible and convenient, use the con without manual shutdown, will automatically close the current connection
Using (SqlConnection con=new SqlConnection (Constr))
{
Open connection
Con. Open ();
String cmdstr = "SELECT * from Ns_user where userid= @myid and username= @myname";
SqlCommand cmd = new SqlCommand (Cmdstr,con);
This uses parameter serialization
SQL Server 2008 provides an enhanced SQL command merge for use in the msdn:http://msdn.microsoft.com/zh-cn/library/bb510625.aspx
Function: Inserts, updates, or deletes on the target table based on the results of joining with the source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in a table based on differences foun
(SqlServer2008PlusTestAttribute), "versions") { }}
Once attributes is available, it is easier to run a separate test for our version.
[SqlServer2008PlusTest] public void ScanAllNullSparse (DatabaseVersion version) {RunDatabaseTest (version, db => {var versions = new DataScanner (db); var rows = tables. scanTable ("ScanAllNullSparse "). toList (); // sparse column Assert. areEqual (null, rows [0]. fie
statement.Skip Gathing to lock other rows that meet the criteriaSteps:Window 1 (each window represents a session) executesSelect *from goods where Goods_code = ' 9990300100000030001 ' for update;In Windows 2, execute:Because a row in the SQL collection of window 2 is locked by a collection of Windows 1, window two waits for the lock to be released.Window 2 modif
-running test projects and focus only on those categories that were quickly completed.LOB types need to be tested in particular because they involve a lot of disk activity before the database starts, configuration tables and configuration rows are createdLooking to the futureAdding a new version is as simple as installing SQL Server, adding a connection string to the configuration item, and finally adding t
| 29000 |
1 | +----+--------+------+----------+-----------+ rows in Set (0.00 sec) [[emailprotected] opt]# perl binlog-rollback.pl -f ‘/data/mysql/data/mysql-bin.000004‘ -o ‘/tmp/update.sql‘ -u ‘admin‘ -p ‘admin‘ -h 127.0.0.1 -i
Warning: Using a password on the command line interface can be insecure. Since all SQL domain names are recorded in mysql-bin.000004, and the binlog-rollback.pl tool is
Tags: val operation data operation IAR Comma ICA multiple span insertSometimes data operations are required, and data is updated if there is data, and no data is inserted. The previous practice is to query, and then based on the query results to judge, to perform the INSERT or update operationThere is actually an on DUPLICATE KEY UPDATE syntax that allows you to
were quickly completed.LOB types need to be tested in particular because they involve a lot of disk activity before the database starts, configuration tables and configuration rows are createdLooking to the futureAdding a new version is as simple as installing SQL Server, adding a connection string to the configuration item, and finally adding the SQL Server ver
I have been learning about SQL Server recently. I took a test yesterday. It's really not easy. In particular, some complex queries. It makes me dizzy. However, it is also because your knowledge is not solid enough. So today I reviewed the addition, deletion, modification, and query of the T-SQL statement. Many of them are indeed forgotten. Write the result. Don't forget it in the future.
--
ACCESSExample:Insert into Products (PRONUMBER,CASNUMBER,CNNAME,PRICE,ENNAME,BAOZHUANG,PINPAI) Select Pronumber,casnumber,cnname, Price,enname,baozhuang,pinpai from product221. Use one sentence of SQL to extract data from a table into another table. This is useful for data conversion between different programs, and it is fast and data is complete:Insert INTO table1 (column1,column2,...) Select Column1,column2,... from table2(where Table1 's fields corr
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.