MySQL Database Common Commands1. mysql Common commandsCreate database name; Create a databaseUse DatabaseName; Select DatabaseDrop database name deletes databases directly and does not alertShow tables; Show TableDescribe TableName; Detailed
If Table A's primary key is a field in table B, the field is called the Foreign key of Table B, table A is called the primary table, and table B is called from the table. Foreign keys are used to achieve referential integrity, and different foreign
"Three major paradigms of database design"1. First paradigm (1NF): Each column in the data table must be the smallest unit that cannot be split. That is to ensure the atomicity of each column.For example: UserInfo: ' Shandong province Yantai 18865518
Describe a table with DESC employeesFilter Duplicate department SELECT distinct DEPARTMENT_ID from EmployeesThree ways to alias: 1, Space 2, plus as 3, "" (the alias of multiple words must be separated by a space, or by an underscore)Condition
3, add the syntax of the foreign key:There are two ways of doing this:
Method One: Add when creating a table
Mode two: The table has been created, continue to modify the structure of the table to add foreign keys
"Way One" is added
If a field of one entity points to the primary key of another entity, it is called a foreign keyThe entity that is pointed to is called the primary entity (the primary table), also called the parent entity (the parent table).The entity that is
1.BaseDao: Abstract base class, which defines the underlying database operation methods used to open the connection, get statement, execute SQL, and close the resource.2.i***dao: An interface that operates on a specified data table: An abstract
must state : This blog is reproduced in Oracle foreign KEY cascade DELETE and cascade update http://www.2cto.com/database/201507/417496.htmlIn view of the previous collection of wonderful blog has been deleted, it is very sad, so still want to
MySQL supports foreign key storage engine only InnoDB, when creating foreign keys, requires the parent table must have a corresponding index, the child table when creating foreign keys will also automatically create the corresponding index. When you
/* Primary key cannot be null NULL, the primary key of a table can only be by one, a primary key is a unique UK/*/*primary key (SNAME,SID) composite primary key can be controlled at the same time sname,sid less *//* Foreign key FK is generally 2
what is the storage engine? Mysqldata is stored in a file using a variety of different technologies(or Memory)the. Each of these technologies uses different storage mechanisms, indexing techniques, locking levels, and ultimately offers a wide range
Recently in the busy exam, more annoying! I have a circle when I see the exam! Complete brain blank, uncontrolled, coupled with the abnormal Proctor teacher, not to mention how painful. Fortunately, the successful completion of the exam, spare some
In MySQL, a table of the InnoDB engine type supports foreign key constraints. [CONSTRAINT symbol] FOREIGN KEY [id] (index_col_name, ...) REFERENCES tbl_name (index_col_name, ...) [on DELETE {RESTRICT | CASCADE | SET NULL | NO ACTION | SET
Common commands for MySQL database operations and Common commands for mysql
Common commands for MySQL database operationsDOS Connection database1. Install MySQL to configure the environment2. Run the cmd command. net start mysql3. Find the root
MySQL (6), mysql1 foreign key
Foreign key: foreign key, the external key (the key is not in the table itself). If a field (non-primary key) in a table points to the primary key of another table, this field is called a foreign key.
1.1 add
Add a foreign key for the added Data Table: syntax: altertable table name addconstraintFK_IDforeignkey (your foreign key field name) REFERENCES external table name (corresponding table's primary key field name); example:
Database Learning (4) -- create and update a data table 1 Database Learning (3) -- create and delete a database http://www.bkjia.com/database/201305/207489.html data table is a level object for operations in a relational database. In relational
Mysql cascade operation (Instance)
MySQL only supports the InnoDB Storage engine for Foreign keys. When creating foreign keys, the parent table must have corresponding indexes, when a sub-Table creates a foreign key, the corresponding index is
(5) Common mysql storage enginesOverview
?? Before mysql5.5, the default storage engine is MyISAM, and after 5.5, it is changed to InnoDB. To modify the default engine, you can modify the default-storage-engine in the configuration file. You can use
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.