Arjun Thakur has Published 1109 Articles

How to find and replace string in MySQL database for a particular string only?

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

2K+ Views

Use the replace() function to replace string in MySQL Database.The syntax is as followsUPDATE yourTableName SET yourColumnName=replace(yourColumnName, 'yourExistingValue', 'yourNewValue') WHERE >;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table findAndReplaceDemo    -> (    -> Id int NOT ... Read More

Bulk change all entries for a particular field in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

243 Views

Let us first create a demo table −mysql> create table BulkChangeDemo    -> (    -> CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> CustomerName varchar(20),    -> isEducated boolean    -> ); Query OK, 0 rows affected (1.47 sec)Insert some records in the table using insert command. The ... Read More

Collectors averagingLong () method in Java 8

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

226 Views

The averagingLong() method of the Collectors class returns a Collector that produces the arithmetic mean of a long-valued function applied to the input elements.The syntax is as followsstatic Collector averagingLong(ToLongFunction

Write a MySQL query where length of the records is longer than 1?

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

207 Views

Here, we will use OCTET_LENGTH to check the length of a record since we want the records with length more than 1. Let us first create a table −mysql> create table DemoTable (    UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    UserName varchar(20),    UserGender varchar(20) ); Query OK, ... Read More

What are important server response headers that are useful in web programming?

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

122 Views

Following is a summary of the most useful HTTP 1.1 response headers which go back to the browser from the web server. These headers are frequently used in web programming −Sr.No.Header & Description1AllowThis header specifies the request methods (GET, POST, etc.) that the server supports.2Cache-ControlThis header specifies the circumstances in ... Read More

C Program to print numbers from 1 to N without using semicolon

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

949 Views

Here we will see a tricky solution of the problem. We shall print some numbers from 1 to N without using any semicolon.We can solve this problem in two different methods. The first one is the Iterative method, and second one is recursive method.Method 1The printf() function returns the length ... Read More

Subtract content of two ports by interfacing 8255 with 8085 microprocessor

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

384 Views

In this program we will see how to perform subtraction by using ports to take data and send the result into the port.Problem StatementWrite 8085 Assembly language program for interfacing between 8085 and 8255. Here Port A and Port B are holding two values, take the numbers from port A ... Read More

IntStream sorted() method in Java

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

236 Views

The sorted() method in Java IntStream class is used to return a stream consisting of the elements of this stream in sorted order.The syntax is as followsIntStream sorted()The sorted() method returns the new stream. To work with the IntStream class, you need to import the following packageimport java.util.stream.IntStream;Create an IntStream ... Read More

Which datatype should I use for flag in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

1K+ Views

To set a flag, you can set the type as tinyint(1) type. Following is the syntax −yourColumnName tinyint(1) DEFAULT 1;Let us first create a table −mysql> create table DemoTable (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientName varchar(20),    isMarried tinyint(1) DEFAULT 1 ); Query OK, 0 rows ... Read More

Compare only day and month with date field in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 30-Jul-2019 22:30:25

2K+ Views

You can compare only day and month with date field in MySQL with the help of DATE_FORMAT().The syntax is as followsselect *from yourTableName WHERE DATE_FORMAT(yourColumnName, '%m-%d') = DATE_FORMAT('yourValue', '%m-%d') and yourCondition;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create ... Read More

Advertisements