Use python to import the pymysql database to operate mysql (add, delete, modify, and query) and pythonpymysql
Install pymysql first. Run pip install pymysql on the command line.
After installation, connect to the mysql database:
Import pymysql. cursors
'''Connect to database'''
# Use the pymysql command to connect to the database
Connection = pymysql. connect (host = '192. 0.0.1 ', # IP address of the datab
peopleSelect Name fromdepartment where IDinch(select dep_id fromEmployee GROUP BY DEP_ID have count (id) 3 sub-query with exists keywordThe EXISTS key word indicates existence. When you use the EXISTS keyword, the inner query statement does not return a record of the query.Instead, it returns a true and False value. True or FalseWhen True is returned, the outer query
First, install the MySQL/Mariadb server and client, and connect to the server.In the command, uppercase letters are the keywords of SQL, and lowercase letters are their own attributes and data.0X00 connect to the databaseConnect to 127.0.0.1 using mysql and log on with the root user. The password is waiting for input.Mysql-h 127.0.0.1-u root-p0X01 create a databaseCreate a database named schoolCreate database school;0X02 create a tableCreate a table named studentIndex:Name with a length of 10 ch
There are indeed many examples on the Internet, but I am still not satisfied with the search process, so I will summarize it myself to make it easier for me to refer to it later, as well as to facilitate other children's shoes to find information.
Springldap operation LDAP example (add, delete, modify, and query)
Before reading this article, we 'd better understand the schema file of OpenLDAP, that is, unde
SQL statement to query duplicate records and delete Repeated Records Search for records with all repeated titles:
Select * From t_info A where (select count (*) from t_info where title = A. Title)> 1) Order by title DESC
I.
Search for duplicates Recording
1. Search for all Repeated Records
Select * from table where repeated field in (select repeated field from Table group by repeated field having count (*)
count (*) > 1)and rowID not in (select min (rowid) from Vitae GROUP by PEOPLEID,SEQ have Count (*) >1)Add:There are more than two duplicate records, one is a completely duplicate record, that is, all the fields are duplicated records, and the second is some key field duplicate records, such as the Name field is repeated, and the other fields may not be repeated or repeated can be ignored.1, for the first kind of repetition, easier to solve, usingSELECT DISTINCT * from TableNameYou can get a res
(select Peopleid,seq from Vitae GROUP by PEOPLEID,SEQ have count (*) > 1)and rowID not in (select min (rowid) from Vitae GROUP by PEOPLEID,SEQ have Count (*) >1)Add:There are more than two duplicate records, one is a completely duplicate record, that is, all the fields are duplicated records, and the second is some key field duplicate records, such as the Name field is repeated, and the other fields may not be repeated or repeated can be ignored.1, for the first kind of repetition, easier to so
How to query and delete duplicate records(1)1. Search for redundant duplicate records in the Table. duplicate records are determined based on a single field (peopleid ).Select * from peopleWhere peopleid in (select peopleid from people group by peopleid having count (peopleid)> 1)2. Delete unnecessary duplicate records in the Table. Repeat records are determined
SQL statement for querying and deleting duplicate records1. Search for redundant duplicate records in the Table. duplicate records are determined based on a single field (peopleid ).Select * from peopleWhere peopleid in (select peopleid from people group by peopleid having count (peopleid)> 1)2. Delete unnecessary duplicate records in the Table. Repeat records are determined based on a single field (eagleid), leaving only the records with the smallest
the conflicting condition. But it won't recover.Directories that were deleted16. Code Base URL ChangeSVN switch (SW): updates the working copy to a different URL.Usage: 1, switch URL [PATH]2. Switch--relocate from to [PATH ...]1, update your working copy, map to a new URL, its behavior is similar to "SVN update", will alsoThe files on the server are merged with the local files. This is the one where the working copy corresponds to a branch or tag in the same warehouse.Method.2, rewrite the work
Add, delete, modify, and query in ADO. NET
ADO. NET:Data Access Technology
Is a link connecting C # And MSSQL
You can use ADO. NET to write temporary data in the memory to the database.You can also extract data from the database to the memory for the program to call.
Basic of all data access technologies
Basic Format of database connection:Two classes are required.1. SqlConnection for database connection2.
Add, delete, modify, and query this table in the oracle trigger (1) only the before insert trigger can query or update this table.
Create or replace trigger tri_test_ins before inserton testfor each rowdeclare v_cnt integer; begin select count (*) into v_cnt from test; dbms_output.put_line ('test count: '| to_char (v_cnt )); update test set a9 = '99'; end;
Afte
Add, delete, modify, and query operations in the CI (CodeIgniter) framework. The code for copying the CodeIgniter data function class in systemdatabaseDB_active_rec.php is as follows: spanclassModelNameextendsCI_Model {function _ construct () CodeIgniter data function class in \ system \ database \ DB_active_rec.php
The code is as follows:
Class ModelName extends CI_Model{Function _ construct (){Parent:
proc_person_update (1, 'zhaoliu', 20, 'zhao123', @ flag); select @ flag;
If the @ falg value is 1, the update is successful. The execution result is as follows:
Iii. Query
1. query a single
The result set is returned.
DROP PROCEDURE IF EXISTS proc_person_findOne;CREATE PROCEDURE proc_person_findOne( IN uid INT(11))BEGIN SELECT username, age, password FROM person WHERE id = uid;END;CALL proc_person_f
Spcontext. Current. Web. Lists ["userinfo"]: gets the list of websites. The name is userinfo.
Userlist. additem (): add data to the list
User. Update (): Save the data to the list and update the data in the list.
Getitembyid: Get the ID of the current row
Query. Query (XML method condition): Filter query Conditions
Add
protected void bt_SaveClick(object sender
); // Open the local Access Library Demo. mdb}Catch (_ com_error e){AfxMessageBox ("database connection failed. Check whether the database NXYH. mdb is in the current path! ");}Try{PRs-> Open ("SELECT * FROM coordinate", // query all fields in the DemoTable tablePConn. GetInterfacePtr (), // obtain the IDispatch pointer of the database connected to the databaseAdOpenDynamic,AdLockOptimistic,AdCmdText );}Catch (_ com_error * e){AfxMessageBox (e-> Error
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.