- 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
Rama Giri has Published 110 Articles
Rama Giri
249 Views
For this, use the aggregate function SUM(). Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> € int -> ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert ... Read More
Rama Giri
71 Views
To return the first n letters, use the LEFT() function. Following is the syntax −select left(yourColumnName, yourValue) from yourTableName;Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> CourseTitle text -> ); Query OK, 0 ... Read More
Rama Giri
210 Views
For this, you can use CREATE TABLE AS SELECT statement. Let us first create a table −mysql> create table DemoTable1 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> CountryName varchar(20) -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the ... Read More
Rama Giri
617 Views
For this, you can use IFNULL(). Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Value int -> ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command ... Read More
Rama Giri
184 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Id int, -> Value int -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 85885); Query ... Read More
Rama Giri
2K+ Views
Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(100) -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('John'); Query ... Read More
Rama Giri
216 Views
For this, you can use DATEDIFF() function. The current date time is as follows −mysql> select now(); +---------------------+ | now() | +---------------------+ | 2019-06-09 19:15:56 | +---------------------+ 1 row in set (0.00 sec)Let us first create ... Read More
Rama Giri
346 Views
You can use UNION ALL for this.Let us get list 10, 20, 30, 40, 50 as a table with UNION ALL −mysql> select 10 Number UNION ALL select 20 Number UNION ALL select 30 Number UNION ALL select 40 Number UNION ALL select 50 Number;Output+--------+ | Number | +--------+ | 10 | | 20 | | 30 ... Read More
Rama Giri
410 Views
For concatenating a string field, use CONCAT() function. Let us first create a table −mysql> create table DemoTable -> ( -> SequenceId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentId varchar(100) -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using ... Read More
Rama Giri
83 Views
To work with auto incrementing column, you can set it as AUTO_INCREMENT while creating the table.Let us first create a table. Here, we have set the Id field as column since that would be our auto increment column −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> FirstName varchar(20), ... Read More
To Continue Learning Please Login
Login with Google