AmitDiwan has Published 11365 Articles

Can we use SELECT NULL statement in a MySQL query?

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:56:07

179 Views

Yes, we can use the SELECT NULL statement in a MySQL query. Let us first create a table −mysql> create table DemoTable (    Name varchar(100) ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, 1 ... Read More

Update only a single value from a MySQL table where select from same table ordered in descending order?

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:53:55

65 Views

For this, use ORDER BY DESC with the LIMIT clause. The ORDER BY DESC order in descending order where LIMIT sets the number of records you want. Here, we will set LIMIT 1 since we want only a single record. Let us first create a table −mysql> create table DemoTable ... Read More

How to update a MySQL column by subtracting a value with some conditions?

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:49:00

762 Views

Let us first create a table −mysql> create table DemoTable (    Score int ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(45); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(29); Query OK, 1 ... Read More

Return true or false in a MySQL select if another field contains a string?

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:45:24

2K+ Views

To return TRUE or FALSE if another field contains a string, use IF(). Let us first create a tablemysql> create table DemoTable (    FirstName varchar(100),    LastName varchar(100) ); Query OK, 0 rows affected (1.28 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', ... Read More

How to get a value more than a particular value from varchar column in MySQL?

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:40:10

351 Views

Since the column wherein you want to get the value more than a particular value is VARCHAR, use the CAST() function. For example, to fetch the value more than 999 from a column with varchar values.Let us first create a table −mysql> create table DemoTable (    Value varchar(100) ); ... Read More

MySQL query to check if a string contains a value (substring) within the same row?

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:36:49

578 Views

Since we need to match strings from the same row, use LIKE operator. Let us first create a table −mysql> create table DemoTable (    FirstName varchar(100),    FullName varchar(100) ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More

HTML oninvalid Event Attribute

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:28:09

232 Views

The HTML oninvalid event attribute is triggered when an input field is invalid while submitting the form in an HTML document.SyntaxFollowing is the syntax −ExampleLet us see an example of HTML oninvalid event Attribute −    body {       color: #000;       height: ... Read More

HTML oninput Event Attribute

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 12:25:46

230 Views

The HTML oninput event attribute is triggered when the user enters input in an input/textarea HTML element in an HTML document.SyntaxFollowing is the syntax −ExampleLet us see an example of HTML on input event Attribute −    body {       color: #000;       ... Read More

HTML Screen width Property

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 11:42:48

230 Views

The HTML Screen width property returns the total width of the user’s screen.SyntaxFollowing is the syntax −screen.widthExampleLet us see an example of HTML Screen width Property −    body {       color: #000;       height: 100vh;       background-color: #FBAB7E;       ... Read More

Stream.Builder build() in Java

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:46:12

821 Views

The build() method of the Stream.Builder class builds the stream, transitioning this builder to the built state. The syntax is as follows −Stream build()Following is an example to implement the build() method of the Stream.Builder class −Exampleimport java.util.stream.Stream; public class Demo {    public static void main(String[] args) {   ... Read More

Advertisements