What are DDL and DML?

The following is adapted from here MySQL What is DDL, DML and DCL?: DDL DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database. CREATE – to create database and its objects like (table, index, views, store procedure, function and triggers). … Read more

How to delete a column from a table in MySQL

ALTER TABLE tbl_Country DROP COLUMN IsDeleted; Here’s a working example. Note that the COLUMN keyword is optional, as MySQL will accept just DROP IsDeleted. Also, to drop multiple columns, you have to separate them by commas and include the DROP for each one. ALTER TABLE tbl_Country DROP COLUMN IsDeleted, DROP COLUMN CountryName; This allows you … Read more

How to reset Postgres’ primary key sequence when it falls out of sync?

— Login to psql and run the following — What is the result? SELECT MAX(id) FROM your_table; — Then run… — This should be higher than the last result. SELECT nextval(‘your_table_id_seq’); — If it’s not higher… run this set the sequence last to your highest id. — (wise to run a quick pg_dump first…) BEGIN; … Read more

tech