- Trending Categories
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 4378 Articles for MySQL
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
268 Views
While using the ASCII() function with WHERE clause, the output returns by it will depend upon the condition given in WHERE clause. For example, suppose we have a table named ‘Student’ and we want to get the number code, higher than 65, of the first characters of the names of the students. The query for this can be written as follows −mysql> Select * from student; +------+---------+---------+-----------+ | Id | Name | Address | Subject | +------+---------+---------+-----------+ | 1 | Gaurav | Delhi | Computers | | 2 | Aarav | Mumbai | ... Read More
![Ayyan](https://www.tutorialspoint.com/assets/profiles/13521/profile/60_79767-1512650417.jpg)
69 Views
In this case, the output of ASCII() function depends on the condition that whether we are providing NULL as a string or we are providing simply NULL to it. Following example will demonstrate the difference −mysql> SELECT ASCII(null); +-------------+ | ASCII(null) | +-------------+ | NULL | +-------------+ 1 row in set (0.00 sec) mysql> SELECT ASCII('null'); +---------------+ | ASCII('null') | +---------------+ | 110 | +---------------+ 1 row in set (0.00 sec) mysql> Select ASCII(NULL); +-------------+ | ASCII(NULL) | +-------------+ | NULL | +-------------+ 1 row in set ... Read More
![seetha](https://www.tutorialspoint.com/assets/profiles/13549/profile/60_42938-1512640859.jpg)
110 Views
MySQL AUTO_INCREMENT value starts from 1 but we can change it with the help of following two ways −With the help of ALTER TABLE query We can use ALTER TABLE query to change the staring value of AUTO_INCREMENT as follows −ALTER TABLE table_name AUTO_INCREMENT = value;ExampleSuppose we have created a table having column ‘id’ as AUTO_INCREMENT. Now if we will insert the values in it then the sequence number would start from 1 as you can see this in following queries −mysql> Create Table EMP(id int NOT NULL PRIMARY KEY AUTO_INCREMENT, NAME VARCHAR(10)); Query OK, 0 rows affected (0.07 sec) ... Read More
![vanithasree](https://www.tutorialspoint.com/assets/profiles/13547/profile/60_85216-1512542720.jpg)
644 Views
When the AUTO_INCREMENT column reaches the upper limit of data type then the subsequent effort to generate the sequence number fails. That is why it is advised to use a large enough integer data type for the AUTO_INCREMENT column to hold the maximum sequence value required by us. For example, if we will use TINYINT then AUTO_INCREMENT would be able to generate only 127 sequence numbers and in case of UNSIGNED TINYINT, this value can be extended up to 255.
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
68 Views
String function ASCII() in MySQL returns the ASCII number code of the specific character.SyntaxASCII(str)Here, str, the argument of ASCII() function, is the string whose ASCII value of the first character to be retrieved.It is pertinent to mention here that it will return the number code the left the most character i.e. first character of the string given as argument.Examplemysql> SELECT ASCII('A') as 'ASCII VALUE OF CAPITAL A'; +--------------------------+ | ASCII VALUE OF CAPITAL A | +--------------------------+ | 65 | +--------------------------+ 1 row in set (0.00 sec) mysql> SELECT ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
177 Views
As we know that MySQL LAST_INSERT_ID() function returns the latest generated sequence number but in case of multiple row-insert it would return the sequence number generated by the foremost inserted row.Examplemysql> Insert into Student(Name) values('Ram'), ('Mohan'), ('Aryan'); Query OK, 3 rows affected (0.03 sec) Records: 3 Duplicates: 0 Warnings: 0The query above inserts three values in Student table with the help of Multiple-row insert query. The value of Column ‘Id’ can be checked with the help of the following query −mysql> Select * from Student; +----+-------+ | Id | Name | +----+-------+ | 1 | Raman | | 2 | ... Read More
![radhakrishna](https://www.tutorialspoint.com/assets/profiles/13544/profile/60_40618-1512640354.jpg)
215 Views
MySQL LAST_INSERT_ID() function is used to obtain the most recent generated sequence number by AUTO_INCREMENT.ExampleIn this example, we are creating a table named ‘Student’ having an AUTO_INCREMENT column. We insert two values in the column ‘Name’ and when we use INSERT_LAST_ID() function then it returns the most recent generated sequence number i.e. 2.mysql> Create table Student(Id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, Name Varchar(5)); Query OK, 0 rows affected (0.13 sec) mysql> Insert into student(Name) Values('Raman'); Query OK, 1 row affected (0.06 sec) mysql> Insert into student(Name) Values('Rahul'); Query OK, 1 row affected (0.07 sec) mysql> Select* ... Read More
![Moumita](https://www.tutorialspoint.com/assets/profiles/13507/profile/60_122499-1557898491.jpg)
901 Views
With the help of INSERT INTO command, a new row can be inserted into a table.SyntaxINSERT INTO table_name values(value1, value2, …)ExampleSuppose we have a table named ‘Employee’ with three columns ‘Emp_id’, ‘Emp_name’ and ‘Emp_Sal’ then with the help of following query we can add new rows to the table −mysql> INSERT INTO Employee values(110, 'Aarav', 50000); Query OK, 1 row affected (0.07 sec) mysql> INSERT INTO Employee values(200, 'Raman', 28000); Query OK, 1 row affected (0.10 sec) mysql> Select * from Employee; +---------+-------------+-----------+ | Emp_id | Emp_name | Emp_sal | +---------+-------------+-----------+ | 110 |Aarav ... Read More
![Swarali Sree](https://www.tutorialspoint.com/assets/profiles/13515/profile/60_84115-1512649510.jpg)
374 Views
For inserting data into a MySQL table we need to use INSERT INTO command. We must have to specify values for all the columns of the table in INSERT INTO command.SyntaxINSERT INTO table_name values(value1, value2, …)ExampleSuppose we have a table named ‘Student’ with three columns ‘RollNo’, ‘Name’ and ‘Class’ then with the help of following query we can add new rows to the table −mysql> INSERT INTO Student values(50, 'Harshit', ’B.tech’); Query OK, 1 row affected (0.07 sec) mysql> INSERT INTO Student values(56, 'Amit', ’M.tech’); Query OK, 1 row affected (0.05 sec) mysql> Select * from Student; +---------+-------------+-----------+ ... Read More