MySQL (C API) VC example and code download (1)_PHP tutorial

WBOY
Release: 2016-07-13 17:03:10
Original
823 people have browsed it

1. Description: Copy table (only copy structure, source table name: a, new table name: b)

SQL: select * into b from a where 1 1

2. Description: Copy table (copy data, source table name: a target table name: b)

SQL: insert into b(a, b, c) select d,e,f from b;

3. Description: Display the article, submitter and last reply time

SQL: select a.title,a .username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b

4. Description: Outer join query (table name 1: a Table name 2: b)

SQL: select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUTER JOIN b ON a.a = b.c

5 .Description: Schedule reminder five minutes in advance

SQL: select * from schedule where datediff('minute',f start time,getdate())>5

6. Description: Two related tables, delete the information in the main table that is not in the secondary table

SQL:

delete from info where not exists ( select * from infobz where info.infid=infobz.infid )

Explanation: --

SQL:

SELECT A.NUM, A.NAME, B.UPD_DATE, B.PREV_UPD_DATE

FROM TABLE1,

(SELECT X.NUM, FROM TABLE2

WHERE TO_CHAR(UPD_DATE,'YYYY/MM') = TO_CHAR(SYSDATE, 'YYYY/MM')) X,

(SELECT NUM, UPD_DATE, STOCK_ONHAND

FROM TABLE2

WHERE TO_CHAR(UPD_DATE,'YYYY/MM') =

TO_CHAR(TO_DATE(TO_CHAR(SYSDATE, 'YYYY/MM') || '/01',' YYYY/MM/DD') - 1, 'YYYY/MM') ) Y,



http://www.bkjia.com/PHPjc/630993.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/630993.htmlTechArticle1. Description: Copy table (only copy structure, source table name: a new table name: b) SQL: select * into b from a where 1 1 2. Description: Copy table (copy data, source table name: a target table name: b) SQL: insert...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template