Arjun Thakur has Published 1109 Articles

Python bootstrapping the pip installer

Arjun Thakur

Arjun Thakur

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

505 Views

In addition to the modules and packages built in to the standard distribution of Python, large number of packages from third party developers are uploaded to Python package repository called Python Package Index (https://pypi.org/. To install packages from here, pip utility is needed. The pip tool is an independent project, ... Read More

How to alter the database engine of a MySQL database table?

Arjun Thakur

Arjun Thakur

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

352 Views

First, determine the type of MySQL database i.e. whether its engine is InnoDB or MyISAM. To achieve this, use engine column from the information_schema.columns.tables.The syntax is as follows.SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ’yourDatabaseName’ AND TABLE_NAME = ’yourTableName’;Here, I have a table with the name ‘StudentInformations’ −mysql> create table ... Read More

Multiple COUNT() for multiple conditions in a single MySQL query?

Arjun Thakur

Arjun Thakur

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

8K+ Views

You can count multiple COUNT() for multiple conditions in a single query using GROUP BY.The syntax is as follows -SELECT yourColumnName, COUNT(*) from yourTableName group by yourColumnName;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table MultipleCountDemo -> ... Read More

How to Auto Generate Database Diagram in MySQL?

Arjun Thakur

Arjun Thakur

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

400 Views

To auto generate database diagram in MySQL, use MySQL workbench. For this, select the option from database as shown below −Database->Reverse EngineerHere is the snapshot showing the Database tab −After clicking “Database” above, choose the option “Reverse Engineer”. This state the “Reverse Engineer” mode.Clicking above will display the following table ... Read More

Using “TYPE = InnoDB” in MySQL throws an exception?

Arjun Thakur

Arjun Thakur

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

319 Views

You can use ENGINE = InnoDB in place of TYPE = InnoDB, since the usage of TYPE became obsolete in MySQL version 5.1.The version we are using for our example is MySQL version 8.0.12. Let us check the MySQL version. The query is as follows −mysql> select version();The following is ... Read More

Python class browser support

Arjun Thakur

Arjun Thakur

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

200 Views

The pyclbr module in Python library extracts information about the functions, classes, and methods defined in a Python module. The information is extracted from the Python source code rather than by importing the module.This module defines readmodule() function that return a dictionary mapping module-level class names to class descriptors. The ... Read More

How to update field to add value to existing value in MySQL?

Arjun Thakur

Arjun Thakur

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

8K+ Views

You can update field to add value to an existing value with the help of UPDATE and SET command. The syntax is as follows −UPDATE yourTableName SET yourColumnName = yourColumnName+integerValueToAdd WHERE yourCondition;To understand the above syntax, let us create a table. The query to create a table is as follows ... Read More

Two columns as primary key with auto-increment in MySQL?

Arjun Thakur

Arjun Thakur

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

815 Views

Achieve this using MyISAM Engine. Here is an example of two columns as primary key with auto-increment.Creating a table with two columns as primary key −mysql> create table TwoPrimaryKeyTableDemo -> ( -> Result ENUM('First', 'Second', 'Third', 'Fail') not null, -> StudentId ... Read More

Convert varchar to date in MySQL?

Arjun Thakur

Arjun Thakur

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

5K+ Views

You can use date_format() to convert varchar to date. The syntax is as follows −SELECT DATE_FORMAT(STR_TO_DATE(yourColumnName, 'yourFormatSpecifier'), 'yourDateFormatSpecifier') as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table VarcharToDate    -> (    -> Id ... Read More

How to run SQL script in MySQL?

Arjun Thakur

Arjun Thakur

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

21K+ Views

To run SQL script in MySQL, use the MySQL workbench. First, you need to open MySQL workbench.The snapshot is as follows −Now, File -> Open SQL Script to open the SQL script.Alternatively, use the following shortcut key −Ctrl+Shift+OAfter that an option would be visible for you to choose your .sql ... Read More

Advertisements