AmitDiwan has Published 11365 Articles

MySQL date comparison to fetch dates between a given range?

AmitDiwan

AmitDiwan

Updated on 03-Oct-2019 06:20:15

173 Views

Let us first create a table −mysql> create table DemoTable (    AdmissionDate date ); Query OK, 0 rows affected (0.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-08-31'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('2019-09-01'); Query OK, 1 ... Read More

Conditional WHERE clause in MySQL stored procedure to set a custom value for NULL values

AmitDiwan

AmitDiwan

Updated on 03-Oct-2019 06:18:03

169 Views

To set a custom value for NULL values, use the UPDATE command along with IS NULL property in a stored procedure. Let us first create a table −mysql> create table DemoTable (    Id int,    FirstName varchar(50) ); Query OK, 0 rows affected (0.67 sec)Insert some records in the ... Read More

Autoincrement in MySQL begins from 1? How can we begin it from another number?

AmitDiwan

AmitDiwan

Updated on 03-Oct-2019 06:12:21

653 Views

The autoincrement in MySQL gives a unique number every time. By default, it starts at 1. If you want to start from another number, then you need to change the auto-increment value with the help of ALTER command or you can give value at the time of table creation.Let us ... Read More

How to use three conditions in a single MySQL query with id, name and age of students to fetch record of a student?

AmitDiwan

AmitDiwan

Updated on 03-Oct-2019 06:07:31

197 Views

Let us first create a table −mysql> create table DemoTable (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(50),    StudentAge int ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName, StudentAge) values('Chris', 21); Query OK, ... Read More

Get the count of unique phone numbers from a column with phone numbers declared as BIGINT type in MySQL

AmitDiwan

AmitDiwan

Updated on 03-Oct-2019 06:04:24

628 Views

For this, you can use COUNT() along with DISTINCT. The COUNT() method is to count the records. However, the DISTINCT returns distinct records, whereas COUNT() method counts those unique records. Let us first create a table −mysql> create table DemoTable (    PhoneNumber bigint ); Query OK, 0 rows affected ... Read More

Only display row with highest ID in MySQL

AmitDiwan

AmitDiwan

Updated on 03-Oct-2019 06:02:55

115 Views

To order, use the ORDER BY DESC clause. With that, since we want a single ID, which should be the highest, use LIMIT 1. This will fetch the row with highest ID. Let us first create a table −mysql> create table DemoTable (    Id int,    FirstName varchar(50) ); ... Read More

HTML5 Semantics

AmitDiwan

AmitDiwan

Updated on 01-Oct-2019 11:58:14

571 Views

The HTML5 Semantics refers to the semantic tags that provide meaning to an HTML page. In HTML5 the tags are divided into two categories - semantic and non-semantic. HTML5 brings several new semantic tags to the HTML.Some HTML5 Semantic tags are −TagsExplanationfigureIt specifies an image with different formats.articleIt specifies an ... Read More

HTML Form action Attribute

AmitDiwan

AmitDiwan

Updated on 01-Oct-2019 11:55:02

2K+ Views

The HTML form action attribute defines where to send the form data when a form is submitted in an HTML document.SyntaxFollowing is the syntax −Let us see an example of HTML Form action Attribute −Example Live Demo    body {       color: #000;       height: ... Read More

HTML Window sessionStorage Property

AmitDiwan

AmitDiwan

Updated on 01-Oct-2019 11:51:40

250 Views

The HTML Window sessionStorage property allow us to store key/value pairs data in a web browser only for one session that means the data is deleted when the browser tab is closed.SyntaxFollowing is the syntax −window.sessionStorageLet us see an example of HTML Window sessionStorage Property −Example Live Demo   ... Read More

HTML Window self Property

AmitDiwan

AmitDiwan

Updated on 01-Oct-2019 11:48:09

104 Views

The HTML Window self property returns the current window of the browser.SyntaxFollowing is the syntax −window.selfLet us see an example of HTML Window self Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       ... Read More

Advertisements