Search
 
SCRIPT & CODE EXAMPLE
 

SQL

alter table add foreign key mysql

ALTER TABLE orders
ADD 
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; 
Comment

alter table add column and foreign key mysql

ALTER TABLE database.table
  ADD COLUMN columnname INT DEFAULT(1),
  ADD FOREIGN KEY fk_name(fk_column) REFERENCES reftable(refcolumn) ON DELETE CASCADE;
Comment

mysql alter add foreign key

ALTER TABLE ordenes ADD ticket VARCHAR(50) NOT NULL;
ALTER TABLE ordenes ADD CONSTRAINT fk_ticket FOREIGN KEY (ticket) REFERENCES tickets(ticket);
// I'm Horrible Hyena
Comment

Mysql Create table with foreign keys.

CREATE TABLE products(
    productId INT AUTO_INCREMENT PRIMARY KEY,
    productName varchar(100) not null,
    categoryId INT NOT NULL,
    CONSTRAINT fk_category
    FOREIGN KEY (categoryId) 
    REFERENCES categories(categoryId)
        ON UPDATE CASCADE
        ON DELETE CASCADE
) ENGINE=INNODB;
Comment

mysql alter add foreign key

ALTER TABLE ordenes ADD ticket VARCHAR(50) NOT NULL;
ALTER TABLE ordenes ADD CONSTRAINT fk_ticket FOREIGN KEY (ticket) REFERENCES tickets(ticket);
Comment

add column mysql with foreign key

ALTER TABLE `TABLE_NAME`
ADD COLUMN `COLUMN_NAME` BIGINT(20) UNSIGNED NULL DEFAULT NULL AFTER `AFTER_COLUMN_NAME`, 
ADD FOREIGN KEY `FOREIGN_RELATION_NAME`(`COLUMN_NAME`) REFERENCES `FOREIGN_TABLE`(`FOREIGN_COLUMN`)  ON UPDATE SET NULL ON DELETE SET NULL
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle compile schema 
Sql :: convert epoch to date in sql server 
Sql :: ora-01950 no privileges on tablespace 
Sql :: sql drop primary key 
Sql :: postgresql change column to not null 
Sql :: mariadb show tables 
Sql :: get permissions postgre query 
Sql :: show all tables in oracle 
Sql :: oracle cpu per session 
Sql :: mysql get last id 
Sql :: oracle alter sequence nextval 
Sql :: describe table mysql 
Sql :: postgres drop column if exists 
Sql :: mssql remove column 
Sql :: postgres killing connections on db 
Sql :: dynamics 365 x++ aggregate querybuilddatasource 
Sql :: oracle synonym 
Sql :: sometimes i cant edit sql developer 
Sql :: oracle list data files 
Sql :: sql comment header 
Sql :: How to disable foreign key checks ? 
Sql :: sql delete records older than 1 day 
Sql :: how to delete duplicate rows in oracle 
Sql :: mysql show tables in database 
Sql :: list columns in table postgres 
Sql :: mysql change data type of column 
Sql :: drop primary key 
Sql :: view linked servers sql 
Sql :: how to get slow query log in mysql 
Sql :: install postgresql on raspberry pi 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =