Skip to main content
deepak

Featured

Useful Queries for SQL

SHOW CREATE TABLE employee; - to check the create query for doctor.
ALTER TABLE employee DROP FOREIGN KEY doctor_ibfk_1; -- dropping a constraint from doctor table (see the constraint name from create table command)
ALTER TABLE employee modify id bigint(20) NOT NULL AUTO_INCREMENT -- change type of a column

For finding relations with the corresponding table :-
SELECT * 
FROM information_schema.KEY_COLUMN_USAGE 
WHERE REFERENCED_TABLE_NAME = 'YourTable';

Comments