Create AutoIncrement column/field in Apache Derby
While creating a table a particular column / field can be made autoincrement as : CREATE TABLE students ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), name...
View ArticleImport mysql dump files with view definer and sql security
Views and mysqldump A little back I tried to backup a database from my webhost and restore it on my localhost mysql. It had a few views. The import of the sql file seemed to work fine. But on accessing...
View ArticleCreate foreign key using Phpmyadmin
The innodb storage engine supports foreign keys in Mysql. To create foreign keys in phpmyadmin : 1. Convert both tables into innodb, if they are not already. 2. View the structure of the table which...
View ArticleList foreign keys in mysql
information_schema The following query will list out the foreign keys in mysql. It finds it out from the information_schema database. select concat(table_name, '.', column_name) as 'foreign key',...
View ArticleMysql autoincrement column that resets every month
There are situations when we need an autoincrement field to reset every month or so. Example : Invoice Numbers : Month of october 2011-10-01 2011-10-02 ... ... ... 2011-10-800 Month of november...
View ArticleExport table to csv in mysql
It is possible to export the contents of a table directly to csv format from within mysql. It is useful when migrating large tables. CSV export import is much faster for large tables compared to...
View ArticleOptimise your database design for speed and efficiency – Part 1
Database schemas Databases are present in almost all kinds of application that need to store information in some form or the other. Web applications like blogs, cms, social networking sites or business...
View Article