- 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 4219 Articles for MySQLi
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
248 Views
To set alias for column names, the syntax is as follows −select yourColumnName1 anyAliasName1, yourColumnName2 anyAliasName2 from yourTableName anyAliasName;To understand the above syntax, let us create a table −mysql> create table DemoTable2014 -> ( -> FirstName varchar(20), -> LastName varchar(20) -> ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2014 values('John', 'Smith'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable2014 values('David', 'Miller'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable2014 values('John', 'Doe'); Query OK, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
327 Views
Let us first create a table −mysql> create table DemoTable2013 -> ( -> Name varchar(20) -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2013 values('Chris'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable2013 values('David'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable2013 values('Mike'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable2013 values('Sam'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable2013 values('Bob'); Query OK, 1 row affected (0.12 sec)Display all ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
443 Views
To format date while inserting records, use DATE_FORMAT() in the MySQL INSERT statement. Let us first create a table −mysql> create table DemoTable2012 -> ( -> ShippingDate varchar(20) -> ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2012 values(date_format(curdate(), '%d.%m.%Y')); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable2012 values(date_format(now(), '%d.%m.%Y')); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable2012 values(date_format('2014-01-21', '%d.%m.%Y')); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement −mysql> select *from ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
365 Views
To execute SHOW CREATE TABLE in a stored procedure, use SHOW CREATE TABLE. Let us first create a table −mysql> create table DemoTable2011 -> ( -> StudentId int NOT NULL AUTO_INCREMENT, -> StudentName varchar(20), -> StudentAge int, -> StudentCountryName varchar(20), -> PRIMARY KEY(StudentId) -> ); Query OK, 0 rows affected (0.80 sec)Following is the stored procedure executing SHOW CREATE TABLE −mysql> delimiter // mysql> create procedure test_show_create_demo(table_name varchar(100)) -> begin -> set @query=concat("SHOW CREATE TABLE ", table_name); -> prepare st from @query; -> execute st; -> end ... Read More
![Narendra Kumar](https://www.tutorialspoint.com/articles/images/user_icon.png)
1K+ Views
Problem statementMean is the average of the given data set calculated by dividing the total sum by the number of values in the data set.Mode of a data set is the value that appears most frequently in a series of dataIf our dataset is {1, 2, 3, 4} then mean value is − (1 + 2 + 3 + 4) / 4 = 2.5If our dataset is {1, 2, 3, 4, 1, 1, 1, 1} then mode value is − 1 as it appears 5 times.ExampleFirst, create a table −CREATE TABLE NUMBERS ( value INT )Insert data into the ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
2K+ Views
In this problem, we are given a number n and we have to print all odd numbers from 1 to n and also print the sum of numbers from 1 to n in PL/SQL.PL/SQL is a procedural language extension to SQL. The code is a sequence of instructions that are ground in a block with all related declarations and instructions.Let’s see an example of our problem −Input: 7 Output: odd numbers are: 1, 3, 5, 7 Sum of odd numbers is 16To solve this problem, we will take a number and initialize it to 1 and a sum variable with ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
466 Views
To convert a date format, use STR_TO_DATE() −mysql> create table DemoTable2010 ( DueDate varchar(20) ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2010 values('12/10/2019 12:34:00'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable2010 values('12/12/2011 11:00:20'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable2010 values('31/01/2017 11:00:20'); Query OK, 1 row affected (0.23 sec)Display all records from the table using select statement −mysql> select * from DemoTable2010;This will produce the following output −+---------------------+ | DueDate | +---------------------+ | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
249 Views
Let us first create a table −mysql> create table DemoTable2009 ( Name varchar(20) ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2009 values('John Doe'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable2009 values('Adam Smith'); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable2009 values('John Smith'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable2009 values('David Miller'); Query OK, 1 row affected (0.18 sec)Display all records from the table using select statement −mysql> select * from DemoTable2009;This will produce the following output ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
155 Views
Let us first create a table −mysql> create table DemoTable2008 ( Value int ); Query OK, 0 rows affected (10.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2008 values(10); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable2008 values(20); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable2008 values(30); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable2008 values(-31); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable2008 values(-28); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement −mysql> select ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
270 Views
To insert multiple records quickly, use a single INSERT and follow the below syntax −insert into yourTableName values(yourValue1, yourValue2, ...N), (yourValue1, yourValue2, ...N).....N;To understand the above syntax, let us create a table −mysql> create table DemoTable2007 ( Amount1 int, Amount2 int, Amount3 int ); Query OK, 0 rows affected (1.36 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2007 values(450, 600, 700), (1000, 200, 3000), (800, 900, 1200), (1300, 1500, 2000), (40000, 50000, 6700); Query OK, 5 rows affected (0.11 sec) Records: 5 Duplicates: 0 Warnings: 0Display all records from the table ... Read More