MySQL displays the table-related foreign key relationship SQL and mysqlsql
Just take over the MySQL DATA, often encounter the main foreign key relationship, there is no E-R diagram to help, functions through
closely matched, and for more information about signed and unsigned, see: http://www.verysimple.com/blog/?p=57
2, you are trying to reference one of the foreign keys did not establish an index, or not a primary key, if one of them is not primary key, you must create an index for it.
3, the name of the
database tutorial to ensure that the name is unique, or you add a few random characters after the key name to test whether this is the reason.
4, one or two tables are MyISAM engine tables, if you want to use a FOREIGN key constraint, you must be a InnoDB engine, (in fact, if two tables are MyISAM engines, this error does not occur at all, but it does not produ
Explore how SQL uses INFORMATION_SCHEMA system view to obtain the table's primary and foreign key information bitsCN.com 《
Parsing SQL table structure information query includes primary and foreign keys, auto-incrementThe INFORMAT
This error occurs because mysql has never been able to support the problem. Unfortunately, it does not specify which problem will lead to the above error, below I listed the common causes of this terrible 150 error, and sorted by the possibility size, known reasons:
This error occurs because the mysql tutorial has never been well-supported. Unfortunately, it does not indicate which problem will lead to the above error, below I listed the common causes of this terrible 150 error, and sorted by t
GO--determine if the table exists in the way 1if object_id(N'Ef_user'N'U') is NULL--determine if the table exists in the way 2--If not EXISTS (SELECT * FROM dbo. SysObjects WHERE id = object_id (N ' [Ef_user] ') and OBJECTPROPERTY (ID, ' istable ') = 1)begin--directly create a table with the self-increment and specify
/* To create a foreign key in a new table */create table Sales.tempsalesreason (tempid int. not null,name nvarchar (), CONST Raint pk_tempsales PRIMARY key Nonclustered (tempid), CONSTR
Many tables in SQL Server have foreign key constraints. before deleting these tables, you must first Delete these foreign key constraints.
The stored procedure used to delete the foreign key
The drop TABLE command is used to delete a table or all rows in a table. The syntax format is:
drop TABLE "TableName"
Here's an example:
drop table employee;
To delete the entire table (including all rows), you can use the dro
My BSOOC needs a query table primary key foreign key information SQL, last night to study until 1 o'clock in the morning, finally to achieve this goal:Oracle:Select O.obj# as ObjectId, o.name as TableName, oc.name as ConstraintName,Decode (c.type#, 1, ' C ', 2, ' P ', 3, ' U
We know that the flashback table can restore the drop table from the recycle bin, but not everything about the table can be returned by flashback, such as foreign key constraints.
Duzz $ Scott @ orcl> Create
Tags: table color LTE str int FOREIGN key char arc postEstablish a foreign key relationship: first build the main table goodbye from the table;Main Table:CREATE
Label:
Multi-table design and multi-table query
1. Foreign KEY ConstraintsTables are used to save real-life data, and real-life data and data often have a certain relationship, we use the table to store data, we can explicitly declare the
Just take over MySQL data, often encounter a primary foreign key relationship, there is no E-R diagram to help, functions through SQL query: selectTABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAMEfromINFORMAT just took over MySQL data, often encounter a primary foreign
Label:Cascade Delete.Recently, a contractual relationship has been established, with the addition of a maintenance contract on the original asset platform, and a maintenance contract.Need to add the asset to the maintenance contract, using EF, the added redundant fields have been added, now do this, delete only the main table hint problem, originally I did not select the "cascade Delete" property on the foreign
Label:SELECT Table_name,fk_name,reference_table_name,fk_list_number,fk_detailFrom (SELECT object_name (f.object_id) as Fk_name,object_name (F.PARENT_OBJECT_ID) as TABLE_NAME,object_name (f.referenced_object_id) as Reference_table_name,k.constraint_column_id as Fk_list_number,convert (sysname, col_name (k.referenced_object_id, k.referenced_column_id)) as Fk_detailFrom Sys.foreign_keys FINNER JOIN sys.foreign_key_columns kOn f.object_id = k.constraint_object_id and f.referenced_object_id = k.refer
We know that the Flashback Table can restore the drop Table from the recycle bin, but not everything about the Table can be returned by Flashback, such as foreign key constraints.
Duzz $ scott @ orcl>CreateTableD (deptno numberPrimaryKey, Deptname varchar2 (20 ));
Table
varchar (255),
Address varchar (255), City
varchar (255),
CONSTRAINT pk_PersonID PRIMARY KEY (Id_P,LastName)
)
SQL PRIMARY KEY Constraint on ALTER TABLEIf you create a PRIMARY KEY constraint for the "id_p" column if the table alr
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.