create database university;
use university;
create table department
(dept_name varchar(20),
building varchar(15),
budget numeric(12,2),
primary key(dept_name));
create table course
(course_id varchar(7),
title varchar(50),
dept_name varchar(20),
credits numeric(2,0),
primary key(course_id),
foreign key(dept_name) references department);
Error Code: 1215. --Cannot add foreign key constraint
62 Views Asked by Ardian Syla At
1
There are 1 best solutions below
Related Questions in MYSQL
- MySQL Select Rank
- When dealing with databases, does adding a different table when we can use a simple hash a good thing?
- Push mysql database script to server using git
- Why does mysql stop using indexes when date ranges are added to the query?
- Google Maps API Re-size
- store numpy array in mysql
- Whats wrong with this query? Using ands
- MySQL-Auto increment
- show duplicate values subquery mysql
- Java Web Application Query Is Not Working
- microsoft odbc driver manager data source name not found and no default driver specified
- Setting foreign key in phpMyAdmin
- No responses from google places text search api
- Adding to MAMP database in SQL/PHP
- I want to remove certain parent- and child-divs in all my wordpress posts with php or some other script
Related Questions in FOREIGN-KEYS
- Msg 547- FK Constraint Error
- JPA, Hibernate can I do composite primary key which one element is foreign kay @OneToMany?
- django - "Incorrect type. Expected pk value, received str" error
- How to use django model with foreign key ? Help plss
- belongs_to with foreign_key not working in one direction
- How to prevent inserting duplicate rows based on two foreign keys?
- Cakephp hasMany with multiple foreign keys that are not primary keys
- Sql: Selecting from other tables
- Django admin with inlines, 1 model with 2 foreigns keys to 2 different models
- MySQL Foreign Key Constraint Fail
- How to set "auto insert" foreign key value by using SQL Server?
- delete a record and its FOREIGN key via a sql query
- SQL alchemy - specifying relationships when foreign key may not exist
- Foreign key not updating in entity frame work
- @OneToMany and @ManyToOne foreign key always Null
Related Questions in FOREIGN-COLLECTION
- Sqlite persist object containing collection of objects
- Lazy collections cannot be used if they have been deserialized
- Ormlite - deleting nested objects from ForeignCollection but not from database
- How can I fill the foreign collection manually
- ORMLite foreign collection and serialization
- ForeignCollection not loading with Query Builder
- IllegalArgumentException: Field xxx is a primitive class class xxx but marked as foreign
- ForeignCollection auto load with queryRaw()
- ORMLite many to many relation Android
- Could not create data element in ForeignCollection ORMLite
- Linq Multiple references to a foreign key relationship in a string concatenation
- Composite Pattern with OrmLite for Android
- ORMLite foreigncollection - object searching
- Collections in ORMLite
- Error Code: 1215. --Cannot add foreign key constraint
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You missed specifying the target column of the
departmenttable