Calculate Age from Given Date of Birth in MySQL

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

1K+ Views

To calculate age in MySQL from Date of Birth, you can use the following syntax −SELECT YEAR(CURRENT_TIMESTAMP) - YEAR(yourColumnName) - (RIGHT(CURRENT_TIMESTAMP, 5) < RIGHT(yourColumnName, 5)) as anyVariableName from yourTableName;To understand the above concept, let us create a table. The following is the query to create a table.mysql> create table AgeCalculatesDemo −> ( −> YourDateOfBirth datetime −> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table with the help of insert command. These records are the DOBs through which we will calculate the age. The following is the ... Read More

Set Random Background for RecyclerView in Android

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

3K+ Views

Before getting into set random background color for recycler view example, we should know what is Recycler view in android. Recycler view is a more advanced version of the list view and it works based on View holder design pattern. Using recycler view we can show grids and list of items.This example demonstrates How to set the random background for Recyclerview by creating a beautiful student records app that displays student name with age.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 ... Read More

MySQL String Last Index Of in a URL

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

865 Views

To get the last index, use the SUBSTRING_INDEX() function from MySQL. The syntax is as follows −SELECT yourColumnName1, ...N, SUBSTRING_INDEX(yourColumnName, ’yourDelimiter’, -1)as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table LastIndexString    -> (    -> Id int,    -> yourURL text    -> ); Query OK, 0 rows affected (0.89 sec)Insert some records in the table using INSERT command. The query is as follows −mysql> insert into LastIndexString values(1, 'https −//www.example.com/home.html'); Query OK, 1 row affected (0.26 sec) mysql> insert into LastIndexString values(2, ... Read More

Salary and Perks of the Indian Prime Minister

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

866 Views

The post of Prime Minister of India, for one of the largest and most populated countries in the world, is not an easy position to hold. Since the Prime Minister of the country has to undergo a lot of pressure and work, there are obviously some perks that he or she will be eligible for.Let us see what is the salary of the prime minister is and what are the perks and luxuries that he can access when he is in the post of the prime minister.The monthly salary of the Prime Minister of India is approximately 1, 60, 000 ... Read More

MySQL Stored Procedure Return Value

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

14K+ Views

To return a value from stored procedure, you need to use user defined session specific variable. Add @ symbol before variable name.For example, use @symbol for variable valido. The syntax for the same is as follows:SELECT @valido;Whenever you use select statement, you need to use @anyVariableName. The syntax is as follows:SELECT @anyVariableName;Here is the demo of stored procedure of return value. The query to create a stored procedure is as follows:mysql> create procedure ReturnValueFrom_StoredProcedure -> ( -> In num1 int, -> In num2 int, -> out valido int ... Read More

Get the Creation Date of a MySQL Table

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

10K+ Views

To get the creation date of a MySQL table, use create_time from information_schema.tables. The syntax is as follows −SELECT create_time FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'yourDatabaseName' AND table_name = 'yourTableName';My table name is 'skiplasttenrecords' and database is ‘test’.Implement the above syntax for your database and table name. The query is as follows −mysql> SELECT create_time FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'test' −> AND table_name = 'skiplasttenrecords';The following is the output displaying the creation date −+---------------------+ | CREATE_TIME | +---------------------+ | 2018-11-29 15:47:14 | +---------------------+ 1 row in set (0.00 sec)

Display Records Vertically in MySQL Command Line

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

3K+ Views

You can use backward slash followed by G i.e. \G instead of semicolon(;). The syntax is as follows to show records vertically in MySQL command line.SELECT *FROM yourTableName\GTo understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table showRecordsVertically -> ( -> Id int, -> Name varchar(100), -> Age int -> ); Query OK, 0 rows affected (2.10 sec)Insert some records in the table using insert command. The query is as followsmysql> insert into showRecordsVertically ... Read More

Sort Strings on an Android RecyclerView

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

2K+ Views

Before getting into Sort array list elements for recycler view example, we should know, what is Recycler view in android. Recycler view is a more advanced version of the list view and it works based on View holder design pattern. Using recycler view we can show grids and list of items.This example demonstrates how to integrate Sorted Recycler View by creating a beautiful student records app that displays student name with age.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Open ... Read More

Unwritten Social Rules Everyone Should Follow

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

8K+ Views

Being in a society, you have the responsibility of following some etiquette. These, when followed, makes you a better person as viewed by the society and also help you develop some self-discipline as well.When you are in a group or being associated with a group, you will carry some responsibilities such asBeing polite and using words such as Please, Sorry and Thank you will please the people around you and makes a good impression.Behaving gently and speaking in a normal voice but not loudly.Using your own things and sticking to your boundaries.Asking for permission, if you have to use other's ... Read More

What is a BPO and Qualifications for a Job in BPO

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

4K+ Views

BPO stands for Business Process Outsourcing. This is a great career option for freshers, whether they are technical or nontechnical students. Here a company or a country delegates or employs people to get non-core work done by experts from other companies or other countries. BPO outsourcing can be two types.Back office outsourcing: Herein the jobs are offsite and entail dealing mainly with customer care, data processing, accounting, finance or other technical work. This is a non-voice based BPO category.Front office outsourcing: Here the job is front office service oriented. The nature of the job is to provide customer related services ... Read More

Advertisements