![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4219 Articles for MySQLi
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
270 Views
The repair of MySQL tables is only applicable to MyISAM engine type, not for InnoDB. Therefore, we need to change the Engine type to MyISAM. The following is an example. Creating a table mysql> create table RepairTableDemo -> ( -> id int, -> name varchar(100) -> ); Query OK, 0 rows affected (0.51 sec) To convert this table to engine type MyISAM, use ALTER. mysql> ALTER TABLE RepairTableDemo ENGINE = MyISAM; Query OK, 0 rows affected (1.14 sec) Records: 0 Duplicates: 0 Warnings: ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
5K+ Views
Union is a type of operator in MySQL. We can use ORDER BY with this to filter records. Use UNION if you want to select rows one after the other from several tables or several sets of rows from a single table all as a single result set. Let us see an example. Creating first table mysql> create table UnionDemo1 -> ( -> id int -> ); Query OK, 0 rows affected (0.59 sec) Inserting records into first table. mysql> insert into UnionDemo1 values(1), (4), (10); Query OK, ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
6K+ Views
To create a column with ‘false’ as the default value, we can use the concept of “default” at the time of creation of the table. Note − 0 represents false and 1 represents true. Creating a table using “default” false. mysql> create table TrueFalseTable -> ( -> Adult boolean default false -> ); Query OK, 0 rows affected (0.65 sec) Inserting records with no value, since we have set “default” above. mysql> insert into TrueFalseTable values(); Query OK, 1 row affected (0.16 sec) To display records. ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
31K+ Views
To count the total number of tables, use the concept of count(*) with table_schema. First, to check how many tables are present in our database "business", we need to use the 'show' command. mysql> show tables; The following is the output that displays all the tables in the database "business". +--------------------------+ | Tables_in_business | +--------------------------+ | addcheckconstraintdemo | | addcolumntable | | addconstraintdemo | | addnotnulldemo ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
25K+ Views
The statement select 1 from any table name means that it returns only 1. For example, If any table has 4 records then it will return 1 four times. Let us see an example. Firstly, we will create a table using the CREATE command. mysql> create table StudentTable -> ( -> id int, -> name varchar(100) -> ); Query OK, 0 rows affected (0.51 sec) Inserting records mysql> insert into StudentTable values(1, 'John'), (2, 'Carol'), (3, 'Smith'), (4, 'Bob'); Query OK, 4 rows affected (0.21 ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
3K+ Views
To get a list of MySQL views, we can use the SELECT command with LIKE operator. Let us see the syntax first. mysql> SELECT TABLE_SCHEMA, TABLE_NAME -> FROM information_schema.tables -> WHERE TABLE_TYPE LIKE 'VIEW'; The following is the output that displays the total number of views. +--------------+-----------------------------------------------+ | TABLE_SCHEMA | TABLE_NAME | +--------------+-----------------------------------------------+ | sys ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
2K+ Views
MySQL provides many functions that give the current connection information. For instance, to know about the current user, use the user() function. Syntax mysql> SELECT CURRENT_USER(); Here is the output that displays the name of the current user. +----------------+ | CURRENT_USER() | +----------------+ | root@% | +----------------+ 1 row in set (0.00 sec) In the above, % tells us about localhost. To check the current connection id, use the following method − mysql> SELECT CONNECTION_ID(); The following is the output that shows the current connection id. ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
3K+ Views
To save MySQL query output into a text file, we can use the OUTFILE command. Let us first create a table. mysql> create table SaveintoTextFile -> ( -> id int, -> name varchar(100) -> ); Query OK, 0 rows affected (0.55 sec) Inserting records into the table. mysql> insert into SaveintoTextFile values(1, 'John'); Query OK, 1 row affected (0.44 sec) mysql> insert into SaveintoTextFile values(101, 'Carol'); Query OK, 1 row affected (0.17 sec) mysql> insert into SaveintoTextFile values(3, 'David'); Query OK, 1 row ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
4K+ Views
We can kill the processes with the help of the ‘kill’ command. However, you need to kill those processes one by one, since MySQL does not have any massive kill command. To check how many processes exist, use ‘show processlist’ mysql> show processlist; The following is the output. +----+-----------------+-----------------+------+---------+------+------------------------+------------------+ | Id | User | Host | db | Command | Time | State ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
5K+ Views
The following is the syntax to copy a table from one database to another. INSERT INTO yourDestinationDatabaseName.yourTableName SELECT * from yourSourceDatabaseName.yourtableName; Let us see an example. The CREATE command is used to create a table in the database ‘business’. We are creating a new table here. mysql> use business; Database changed mysql> create table OriginalTable -> ( -> id int -> ); Query OK, 0 rows affected (0.46 sec) Creating a new table in the database ‘test’. mysql> use test; Database changed mysql> create ... Read More