Anvi Jain has Published 629 Articles

How to front pad zip code with “0” in MySQL?

Anvi Jain

Anvi Jain

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

437 Views

To front pad zip code with 0, use LPAD() function in MySQL. The syntax is as follows −SELECT LPAD(yourColumnName, columnWidth+1, '0') as anyVariableName from yourTableName;To understand the above concept of LPAD() to add front pad zip code with 0, let us create a table. One of the columns of the ... Read More

How to store Query Result in a variable using MySQL?

Anvi Jain

Anvi Jain

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

8K+ Views

To store query result in a variable with MySQL, use the SET command. The syntax is as follows −SET @anyVariableName = ( yourQuery);To understand the above concept, let us create a table. The following is the query to create a table −mysql> create table QueryResultDemo    −> (    −> ... Read More

Demonstrate getting the immediate superclass information in Java

Anvi Jain

Anvi Jain

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

108 Views

The immediate superclass information of any entity such as an object, class, primitive type, interface etc. can be obtained using the method java.lang.Class.getSuperclass().A program that demonstrates this is given as follows −Example Live Demopackage Test; import java.lang.*; class Class1{ } class Class2 extends Class1{ } public class Demo { ... Read More

How to order records by a column in MySQL and place empty records at the end?

Anvi Jain

Anvi Jain

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

166 Views

To get order by column and place empty records at the end, use ORDER By and “is null” from MySQL. The syntax is as follows −select *from yourTableName order by if(yourColumName = ’ ’ or yourColumName is null, 1, 0), yourColumnName;To understand the above syntax, let us create a table. ... Read More

Changing the current count of an Auto Increment value in MySQL?

Anvi Jain

Anvi Jain

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

378 Views

You can change the current count of an auto_increment in MySQL using ALTER command.The syntax is as follows −ALTER TABLE yourTableName AUTO_INCREMENT = IntegerValue;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table changeCurrentAutoIncrementValue    −> (   ... Read More

Decrease a row value by 1 in MySQL?

Anvi Jain

Anvi Jain

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

653 Views

You can increase and decrease row value by 1 in MySQL using UPDATE command. The syntax is as follows −UPDATE yourTableName set yourColumnName = yourColumnName-1 where condition;Let us create a table to decrease row value by 1. The following is the query −mysql> create table IncrementAndDecrementValue    −> (   ... Read More

How to create a simple MySQL function?

Anvi Jain

Anvi Jain

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

499 Views

You can create a function using create function command. The syntax is as follows −delimiter // DROP FUNCTION if exists yourFunctionName; CREATE FUNCTION yourFunctionName(Parameter1, ...N) returns type BEGIN # declaring variables; # MySQL statementns END // delimiter ;First, here we will create a table and add some records in the ... Read More

How to sum elements of a column in MySQL?

Anvi Jain

Anvi Jain

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

421 Views

Use aggregate function sum() to sum the elements of a column in MySQL. The syntax is as follows −select sum(yourColumnName1) as anyVariableName1, sum(yourColumnName2) as anyVariableName2, sum(yourColumnName3) as anyVariableName3, ............N from yourTableName;To understand the above syntax, let us create a table. The following is the query to create a table −mysql> ... Read More

Difference between #include and #include "filename" in C/C++?

Anvi Jain

Anvi Jain

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

2K+ Views

The difference between the two forms is in the location where the preprocessor searches for the file to be included.#include The preprocessor searches in an implementation-dependent manner, it searches directories pre-designated by the compiler. This method is usually used to include standard library header files.#include "filename"The preprocessor searches in the ... Read More

Difference between and

Anvi Jain

Anvi Jain

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

169 Views

Ionic is an open source framework used for developing mobile applications. It provides tools and services for building Mobile UI with native look and feel. Lists are one of the most popular elements of any web or mobile application. They are usually used for displaying various information. They can be combined ... Read More

Advertisements