Addition, deletion, modification and query of MySQL table_some words of mysql addition, deletion, modification and query
class=”markdown_views prism-github-gist”> Addition, deletion, modification and query of MySQL tables CRUD is an acronym for the four words Create, Retrieve, Update, and Delete. The operation of the table is based on a set of records; Addition and deletion can only take one record as the basic unit. 1. Add (Create / Insert) Single quotes, double quotes ====” are used in strings, date and time in data records; Backquotes ====” used in the structure of the library name, table name, field name; You can omit backticks at all as long as you are careful to avoid using keywords as library names, surfaces, field names. 1.1 Insert – create table –Build Table–“Student Table Just use the interface CREATE TABLE `db_11_20`.`students` ( `id` INT NOT NULL AUTO_INCREMENT, `sn` INT NOT NULL COMMENT ‘student number’, `name` VARCHAR(45) NOT NULL, `email` VARCHAR(200) NULL, PRIMARY KEY (`id`), UNIQUE INDEX `sn_UNIQUE` (`sn` ASC)); 1.2 Single row data + full column insert Insert one row at a time, and the inserted data contains the data of all fields; Since all fields are inserted, the field part can be omitted in SQL; The order of the values inserted later must be the same as the order in the table…
Android streaming layout, single selection, with edittext, support for soft keyboard input, addition, deletion and deletion_qugengting’s blog
class=”htmledit_views”> Alas, the title is so tiring to write, it may not be able to express clearly after such a long time. There is really no way, this custom layout is relatively highly customized and has many features, because it was an app for email a while ago, and I saw such a layout when referring to QQ mailbox, I thought it was cool, and I wanted to realize it. First paste the renderings to be more intuitive: It should be very clear, flow layout, you can add a title in front (removal is also supported), and there is an input box at the end by default (you can also set it without), the main content of the layout is each label, click to select, it will The soft keyboard pops up automatically, press the delete key to delete the selected label; it also supports the automatic selection of the last label through the delete key of the soft keyboard, and then press the delete key to delete the label; it supports input in the input box to add a label, when Enter the content and add a comma, it will automatically recognize and add the content before the comma…
Addition, deletion, modification and query (CRUD) of Java operation MongoDB database
1. Download the driver https://github.com/mongodb/mongo-java-driver/downloads and import it into the project java 2, build test code import java.net.UnknownHostException; import java.util.Set; import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; import com.mongodb.Mongo; import com.mongodb.MongoException; public class TestMain { public static void main(String[] args) throws UnknownHostException, MongoException { // Mongo m = new Mongo();//default local // Mongo m = new Mongo(“192.168.0.101”);//Default port Mongo m = new Mongo(“192.168.0.101”,27017); //Get the database named alan, create it if it does not exist DB db = m. getDB(“alan”); //Get all databases, do not display db without collection System.out.println(“All database names: “+m.getDatabaseNames()); //Get the collection named testCollection (equivalent to a table), and create it if it does not exist DBCollection coll = db.getCollection(“testCollection”); //Insert value into collection (insert can be inserted) BasicDBObject obj = new BasicDBObject(); obj.put(“name”,”jone”); obj.put(“sex”, “male”); BasicDBObject info = new BasicDBObject(); info.put(“height”, 172); info.put(“weight”, 65); obj.put(“other”, info); coll.insert(obj); //Get all collections under the database, do not display collections without data Set colls = db.getCollectionNames(); for(String s : colls){ System.out.println(s); } //Query all records in coll DBCursor ite = coll. find(); while(ite.hasNext()){ System.out.println(ite.next()); } //Get the first record DBObject o = coll. findOne(); System.out.println(o); “ //Statistics of the number of colletion data System.out.println(coll.getCount()); //…
Addition, deletion, query and modification operations of MongoDB database
This article is a little note on the study of mongodb. It mainly introduces the simplest addition, deletion and modification operations. Beginners, looking at the API, if there is any mistake, I hope you can correct me: (using the official driver) The addition operation is the easiest, just construct bsonDcument and insert it: Method 1, direct construction: MongoServer dbserver = new MongoClient(connectionStr).GetServer(); MongoDatabase db = dbserver.GetDatabase(dbName); MongoCollection collection = db.GetCollection(collectionName); dbserver.Connect(); BsonDocument doc = new BsonDocument(); doc[“Age”] = Int32.Parse(txt_Age.Text); Doc[“Name”] = txt_Name.Text; doc[“Num”] = txt_Num.Text; doc[“Introduction”] = txt_Introduction.Text; Collection.Insert(doc); Method 2, through entity construction: 1 var student = new Student 2 { 3 Age = Int32.Parse(txt_Age.Text), 4 Name = txt_Name.Text, 5 Num = txt_Num.Text, 6 Introduction = txt_Introduction.Text 7 }; 8 9 collection.Insert(student); The key is to construct the deletion condition, and find the signature of the Remove method through the api: public virtual WriteConcernResult Remove(IMongoQuery query); I saw a lot of ways to write BsonDocument objects in Remove on the Internet, but I checked the source code and found that bsonDocument does not implement the IMongoQuery interface at all. The interface is implemented by a class called QueryDocument, and QueryDocument also inherits the BsonDocument object. And there are…