- 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
143 Views
Following is the syntax −select table_name, create_time from information_schema.TABLES where table_schema = 'yourDataBaseName' order by CREATE_TIME desc limit 1;Let us create the first table (Time: 2019-06-10 16:40:51) −mysql> create table DemoTable1 -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(100), -> StudentAge ... Read More
Rama Giri
326 Views
Yes, we can do that using the CASE statement. Let us first create a table −mysql> create table DemoTable -> ( -> isMarried boolean -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(true); Query ... Read More
Rama Giri
100 Views
If given a string containing a path to a file, the PHP basename() function will return the base name of the file. To get its equivalent in MySQL, you can use SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable -> ( -> Location varchar(200) ... Read More
Rama Giri
894 Views
For this, you can use concat() function from MySQL. Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20), -> Subject varchar(100) -> ); Query OK, 0 rows affected (17.73 sec)Insert some ... Read More
Rama Giri
170 Views
Use GROUP BY clause for this. Let us first create a table −mysql> create table DemoTable -> ( -> StudentId int, -> StudentMarks int -> ); Query OK, 0 rows affected (4.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(23, ... Read More
Rama Giri
190 Views
Let us first create a table −mysql> create table DemoTable -> ( -> ShippingDate datetime -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-10 10:04:45'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('2019-06-11 05:45:00'); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable values('2019-06-12 07:00:55'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement ... Read More
Rama Giri
198 Views
For this, concatenate both the date and time using CONCAT() function. Let us first create a table −mysql> create table DemoTable -> ( -> ShippingDate date, -> ShippingTime time, -> ShippingDatetime datetime -> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the ... Read More
Rama Giri
76 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Name varchar(100), -> DueDate datetime -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command. Let’s say the current date is “2019-07-05” −mysql> insert into DemoTable ... Read More
Rama Giri
83 Views
Let us first create a table −mysql> create table DemoTable -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentScore varchar(100) -> ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentScore) values('90'); Query ... Read More
Rama Giri
97 Views
For this, use the substring_index() method. Let us first create a table −mysql> create table DemoTable -> ( -> FolderName varchar(100), -> FolderLocation varchar(200) -> ); Query OK, 0 rows affected (1.03 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('CProgram', ... Read More
To Continue Learning Please Login
Login with Google