About Database programming
1. Simple Introduction to MySQL Database
2.JDBC (Java code to manipulate database)
3.JDBC ( transactional database connection pool)
1. Common Database
1.Oracle database (Large)--oracle
2.db2
3.SQLserver (Medium)
4.MySQL (small)--oracle
Mysql6 before is free, open source.
2. What is a database?
Persistent Devices:
1.IO
2. Database
is a file system that operates data in a file system through a standard SQL language--data that is used to store software systems.
3. What kind of data is stored in the database?
Relational data (somewhat similar to a book)
4. Description:
For example: Mall system
Goods, orders, users
————————
For example, the above three can be said to be entities, represented by a rectangle
The corresponding attribute is represented by an ellipse.
And the relationship between entities is represented by a diamond.
Installation and uninstallation of 5.mysql
1. Uninstall
1. If the data file is separated from the installation file, you should find its location
2. Delete the database normally and delete it in Control Panel
3. Delete data files
4. Delete the remaining data files from MySQL
2. Installation
Attention:
The default port for MySQL is 3306
Character Set selection Utf-8
Service Name:mysql
3. Testing
Open Terminal input: Mysql-u root-p
Enter the password you have set: * * *
If there is a mysql>, it means success.
4. Password reset
1.win environment, enter SERVICE.MSC in "Run" to open all services, locate the corresponding service (find the path) and stop it
2. Enter MySQL under Terminal--skip-grant-tables start service cursor does not move (do not close the window).
3. New open terminal input mysql-u root-p no password required
Use MySQL
Update user set Passwd=password (ABC) Where
User=root
4. Close two terminals, end the MySQL process in Task Manager, and output exit.
5. Restart the MySQL service on the Service Management page
Password modification Complete
———————————
MySQL data server and database and table relationships (including relationships), and finally the client to access
MYSQL-H host name-P Port-U user Name---Enter password
If you have a MySQL server installed on your computer (referring to the software)
The terminal input Mysql-u root-p
——————————
Storage of tables
column field (property), behavior record
The fields in the table correspond to the properties in the class
Table records correspond to specific objects in the class
Class user{
int id;
String name;
int age;
}
User U=new user ();
U.id=1;u.name= "Zhangsan"; u.age=20;
——————————————————
SQL Introduction
SQL Structured Query Language
SQL is a non-procedural language (no correlation between statements, relatively independent)
—————————————————
SQL classification
The DDL data definition language is used to define databases, tables, etc.
DML Database Manipulation language used to delete and change the search
DCL Data Control Language user Rights control
DQL Data Query Statement (*) Select
——————————————————
Basic Database Operations
1. Create/Use/delete database
Create database name;
Use database name
drop database name;
2. Create a database can specify a set of encoding and validation rules
Character Set: Specifies the encoding set used by the database
COLLATE: Specifying how database character sets are compared
Create database data name character set encoding set
Collate check;//with a check rule
Create database name character set= "Utf-general-ci";//Search Manual
Create database name character set= "UTF8";
show databases;
To display a database that already exists
View the definition information for the MYDB2 database that you created earlier
Show CREATE Database mydb2;
Modify the database and change the character encoding (learn)
ALTER DATABASE data name character set= "encoding set" collate= "checksum";
Create database name character set= "GBK";
Show create database name;
ALTER DATABASE data name character set= "encoding set" collate= "checksum";
Switch database
Use db_name;
View the database currently in use
Select Database ();
......
(Add and revise, function, trigger, view, etc. see what you've done in the past.)
One of the database review