George John has Published 1081 Articles

How to set sql_mode permanently in MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:24

977 Views

If you are using Windows Operating System, check your directory my.cnf or my.ini file.mysql> select @@datadir;The following is the output+---------------------------------------------+ | @@datadir ... Read More

How to remove special characters from a database field in MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:24

21K+ Views

You can remove special characters from a database field using REPLACE() function. The special characters are double quotes (“ “), Number sign (#), dollar sign($), percent (%) etc.The syntax is as follows to remove special characters from a database field.UPDATE yourTableName SET yourColumnName=REPLACE(yourColumnName, ’yourSpecialCharacters’, ’’);To understand the above syntax, let ... Read More

Equivalent of SQL Server IDENTITY Column in MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:24

9K+ Views

Equivalent of Microsoft SQL Server IDENTITY column in MySQL is AUTO_INCREMENT. The IDENTITY in SQL Server acts like AUTO_INCREMENT in MySQL.The syntax is as follows −CREATE TABLE yourTableName (    yourColumnName1 dataType NOT NULL AUTO_INCREMENT,    yourColumnName2 dataType,    .    .    .    N,    PRIMARY KEY(yourColumnName1) );In ... Read More

Remove trailing zeros in decimal value with changing length in MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:24

11K+ Views

You can remove trailing zeros using TRIM() function. The syntax is as follows.SELECT TRIM(yourColumnName)+0 FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table removeTrailingZeroInDecimal    -> (    -> Id int not null auto_increment,    -> ... Read More

How to update data in a MySQL database with Java?

George John

George John

Updated on 30-Jul-2019 22:30:24

3K+ Views

To update data into a MySQL database table, use UPDATE command. The syntax is as follows −update yourTableName set yourColumnName1 = value1, ....N where condition;First, we need to create a table. The query is as follows −mysql> create table UpdateDemo    -> (    -> id int,    -> Name ... Read More

Python interface for SQLite databases

George John

George John

Updated on 30-Jul-2019 22:30:24

366 Views

SQLite is an open source database and is serverless that needs no configuration. Entire database is a single disk file that can be placed anywhere in operating system's file system. SQLite commands are similar to standard SQL. SQLite is extensively used by applications such as browsers for internal data storage. ... Read More

How to conduct an Accent Sensitive search in MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:24

329 Views

To conduct an Accent sensitive search in MySQL, we can use collation with utf8_bin. Here is the syntax to conduct accent sensitive search −yourColumName dataType collate utf8_bin;Apply the above syntax to conduct accent sensitive search. First, let us create a table −mysql> create table AccentSearchDemo -> ( ... Read More

Trace or track Python statement execution (trace)

George John

George John

Updated on 30-Jul-2019 22:30:24

5K+ Views

Function in the 'trace' module in Python library generates trace of program execution, and annotated statement coverage. It also has functions to list functions called during run by generating caller relationships.Following two Python scripts are used as an example to demonstrate features of trace module.#myfunctions.py import math def area(x): ... Read More

What are some good tools to visualize MySQL database schema?

George John

George John

Updated on 30-Jul-2019 22:30:24

284 Views

There are many tools to visualize MySQL database schema. Let us see some of them −SchemaSpyThis tool is based on java and can be used to analyze the metadata of MySQL database schema. Also use it to generate a visual representation of schema. A type of command line tool.The following ... Read More

MySQL ALTER column to remove primary key and auto_increment?

George John

George John

Updated on 30-Jul-2019 22:30:24

3K+ Views

You can use ALTER command to remove primary key and auto_increment. The syntax is as follows −ALTER TABLE yourTableName DROP PRIMARY KEY, change yourColumnName yourColumnName data type;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table removePrimaryKey   ... Read More

Advertisements