--CREATE database Db_std_mgr_sys; UseDb_std_mgr_sys;Create TableStudent (std_idbigint not NULLAuto_increment,std_namevarchar(Ten) not NULL default "', Std_codevarchar( -) not NULL default "'Comment'study number, the value is unique', Std_sexvarchar(8) not NULL default "', Std_phonevarchar( -) not NULL default "', school_idbigint not NULL default -1Comment'Your School ID', grade_idBIGINT not NULL default
primary KEY (Primary key) each of the data in the table is a unique value in the form. Other words. It is used to uniquely identify each row of data in a table.The primary key can be a field within the original data. Or a man-made field (a field that has no relation to the original data). A primary
The primary key of Table A acts as a foreign key in Table B. Who is the primary table and who is the subtable?
A as the primary tableB is the slave table
I personally think:
A
Summary
When deleting data in a table with a parent-child relationship, we all know that you must delete the child table before deleting the data in the parent table.
Yesterday we used to delete the child table first, then delete the parent table, delete the use of t
varchar (255), City
varchar (255),
CONSTRAINT pk_personid PRIMARY KEY (id_p, LastName)
)
To create a PRIMARY KEY constraint for the id_p column if the table already exists, use the following SQL Mysql/sql Server/oracl
in two tables to control the data that can be stored in the foreign key table. In a foreign key reference, a link is created between two tables when one or more of the columns containing the primary key values of one
The role of the primary and foreign keys of sql:Foreign key value rule: A null value or a reference primary key value.(1) When a non-null value is inserted, it cannot be inserted if the value is not in the primary key table.(2) When updating, you cannot change the value that
illustrate how to use inner joins and nested queries to implement multi-table queries. In fact, all databases are the same, and SQL statements are generic.I. BASIC OBJECTIVESIt is known that in the test database, the school database can be self-contained, the following table exists:(1) The student table I_student, whi
Summary of index, foreign key, and field syntax maintenance for mysql, SQL Server, and oracle databases, and SQL Server oracle
Summary of index, foreign key, and field syntax maintenance for mysql,
A relational table is actually a collection of a class of entities with common attributes. As defined by the collection, the elements in the collection cannot be duplicated. Similarly, there should be no duplicate records in the relational table. For example, in a student's table, it is not necessary or appropriate to have two records of the same student.
In the
First, create a tabular format:Create Tabletable name (Whether the Field field type can be empty, ...); Comment on columnTable/Field isAn example of a comment:Create TableCompany (com_idINTEGER not NULL, Com_nameVARCHAR2( +)NULL, Com_addressVARCHAR2( -)NULL); Second, create a primary key/FOREIGN
In django, the Data Query condition is that the table columns corresponding to the foreign key in the table should be searched ?, Django table
1. Generally, the condition for finding data in a table is the existing data type in py
1. In the database design process often want to let 2 tables to correlate and use to foreign thus strengthen the constraints between the 2 tables ()Once a problem has not been understood, that is the value of the foreign key column, the normal case of the table column value can be null or satisfy the column of the type
Some SQL (under Oracle) summaries used in the project: 1. Find all indexes of the table (including index name, type, constituent column) 1 Select T.*,i.index_type from User_ind_columns t,user_indexes i where t.index_name = I.index_name and T.tab Le_name = i.table_name and t.table_name = table to query2. lookup table's primary
followingCommand:Select * From user_constraints where table_name = "tabnam ";
".
If it is changed to delete, the deletion is successful.
The explanation provided on the Internet is the difference between DDL and DML (because truncate isn' t going to verify the constraint, truncate is DDL .).
Solution:
SQL> ALTER TABLE ep_pointdisable primary key cascade;The
Problem Description: A basic information table, with more than 30 tables in the system, there is a foreign key relationship, when the basic data to delete, you need to determine whether has been used, if used to change the flag, if not used to delete directly, how to achieve this deal well? It's best to automatically adapt to changes in the
Tags: htm string triggers display interpreting ref DBA more alterORACLE: Enquiry ( See ) table primary key, FOREIGN key, uniqueness constraint, and index 1. Find all indexes of the table (including index name, type, constituent column)Select T.*,i.index_type from User_ind_co
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.