Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

What is NOT NULL Constraint in MySQL?

In MySQL, the NOT NULL constraint is used to restrict a column to NOT accept NULL values. The NOT NULL constraint allows a column to always contains a value which means you cant not insert/update a record in a table without passing value for t...

Difference between DELETE and TRUNCATE in MySQL.

In MySQL, DELETE and TRUNCATE both are used for deleting data from table. DELETE DELETE comes under DML(Data Manipulation Language). DELETE can be used to delete a particular row by using WHERE clause. It is slower than TRUNCATE as...

How to use MIN() function in MySQL?

In MySQL, MIN() function is used to return the smallest value of the specified column in a table. MIN() Syntax SELECT MIN(column_name) FROM table_name; We have a table "employee" as below: employee id first_name ...

How to use AVG() function in MySQL?

What is the use of AVG() function in MySQL? The AVG() function is used to return the average of the numeric column in a table. AVG() Syntax SELECT AVG(column_name) FROM table_name; We have a table "employee" as below: employe...

How to use MAX() function in MySQL?

In MySQL, the MAX() function used to return the largest value of the specified column in a table. MAX() Syntax SELECT MAX(column_name) FROM table_name; We have a table "employee" as below: employee id first_name l...

What is the use of COUNT() function in MySQL?

In MySQL, COUNT() function used to return the number of rows that matches with a specified criteria. Syntax: COUNT(column_name) When we use COUNT(column_name) function in select query it returns the number of rows for the specified colum...

What is NULL value in MySQL?

When we don't define any data for a column then the column holds the NULL value. In MySQL, NULL values are used to represent data that is missing. NULL Values If you have created a table with optional columns then you can insert and update ...

What is Auto-increment keyword in MySQL?

Auto-increment is used to allow a unique number when a new record inserted into a table. Generally we use Auto-increment to create value for primary key field automatically when a new record is inserted into a table. Syntax: The below stat...

How to delete data from a table in MySQL?

To delete data from a table we can use either DELETE or TRUNCATE. DELETE If we want to delete a record from table then we use DELETE FROM statement. Syntax: Below statement deletes rows from table on the basis of where condition, we...

How to delete table/database in MySQL?

We can drop table or database by using DROP keyword. Syntax: The DROP TABLE statement is used to delete a table. DROP TABLE table_name; The DROP DATABASE statement is used to delete a database. DROP DATABASE database_name; E...

How to delete an INDEX in a table in MySQL?

We can drop INDEX from table by using DROP INDEX statement, it is used to delete an index form a table. Syntax: ALTER TABLE table_name DROP INDEX index_name; Example: Suppose you have created an INDEX named "person_user_name_idx" on th...

How to add a column into a table in MySQL?

Sometimes we need to add a column that we require into the table. We can do this by using ADD keyword with ALTER command. Syntax: To add a column into a table, use the following syntax: ALTER TABLE table_name ADD COLUMN column_name data...

How to drop a column from table in MySQL?

Sometimes we need to drop a column that we don't need further from the table. We can do this by using DROP keyword with ALTER command. Syntax: To drop/delete the column from a table, use the following syntax: ALTER TABLE table_name DROP...

Difference between UNION and UNION ALL operators in MySQL.

In MySQL UNION operator used to combine the result of multiple SELECT statements. When we apply the UNION operator then it selects only distinct values by default (No duplicate values are allowed). UNION Operator When we apply UNION operato...

How to insert data from one table to another in MySQL?

We can insert data from one table to another in MySQL. For this we use the INSERT INTO SELECT statement that selects the data from on table and inserts that data into another table. INSERT INTO SELECT Syntax We can select and insert all the...

Difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN in MySQL

In MySQL join is used to combine records from 2 or more tables based on a common column between them. INNER JOIN: It returns all rows when there is a match in both tables. LEFT JOIN: It returns all rows from the left table and matched rows ...

How to get count of duplicate values from table in mysql?

Sometimes we need to check how many duplicate values a column has in MySQL table. We can do this by using "group by" and "having". Example: Suppose you have a table "user" with "fist_name" column from which you want to find all the records w...

How to count unique values from table in mysql?

Sometimes we have the requirement to count how many unique values are in the table. We can do this by using "Distinct" and count(). SELECT COUNT(DISTINCT column_name) FROM table_name; Example: Suppose you have a table user from which you ...

Normalization

Database Normalization Normalization is a technique of managing records in a database. It is an approach to eliminate data redundancy and anamolies . It also removes data duplicacy in a record. It helps in data update,delete and insert anamol...

SQL Selectivity

Selectivity Selectivity is used for the definition of the number of unique values in the table. It shows how many unique values are there in the table. Selectivity=Cardinality/number of record *100% If the selectivity is high than onl...

How to export mysql database using command line?

Sometimes when you have large databases files and you are unable to export the database manually. Then the easiest (and fastest) way is to use command line. Export:- To export the database first need to run the mysqldump.exe and give the fi...

How to import mysql database using command line?

Sometimes when you have large databases files and you are unable to import the database manually. Then the easiest (and fastest) way is to use command line. Import:-- 1. Run the cmd (DOS) and get into the mysql folder, which in my case wo...

ATTACH SQLite Database

Hi, Sometimes, we have many database and we need to use any one of them. In this situation we use SQLite ATTACH DATASE statement to choose a specific database. Syntax of the command: ATTACH Database YOUR_DATASE_NAME As Alias-Name; ...

Database from VS 2012 to VS 2015

Hello, I would like to know if is possible to migrate a database from studio 2012 to 2015. I have an app done in the visual studio 2012 and I would like to open it in the 2015 with the db. Please let me know how or post me some links where I can...

Inserting data in android SQLITE table

Hi again, Here we are going to learn how to insert data in the already created table in android SQLITE. You will find it useful if you are aware of the basic terminology of the android SQLITE, if not and you want to create a table so it will be...

Creating a table in android SQLITE

There are situation when we need to maintain(store) data at our application level, this is mainly done when we try to execute functionalists at offline mode. So for these kind scenarios android sdk has provide us class known as SQLiteOpenHelper w...

How to list table names using primary key of a table

Hello all, I have approx 100 number database tables in db from that I want to list all the tables which is using primary key of a table as a reference in MySQL InnoDB?

Use ORMLite to Optimize your sqlite database

Hey, are you working with large database having many columns and many queries . Is this working slow with sqlite? Thanks to ORMLite that manages your database very efficiently as well as no need to manage lots of queries.... ORMLite supports ...

Frequently used commands in Postgres database with psql command line tool

Connect to local server using psql command line tool with postgres user. sudo -u postgres psql postgres To set/change password of postgres user \password To check/list all databases \list or \l To see/list all tables in current...

Mongodb Error Could not connect to a primary node for replica

Could not connect to a primary node for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">] If you found above error then first check sudo service mongodb status If yes, then run following co...

How to configure database in Codeigniter

Hello Readers, In order to create any web application using Codeigniter framework or any other PHP framework we need to configure database . We have the database file inside application folder of a Codeigniter framework , inside application...
prev 1 2 next
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: