Rishi Rathor has Published 155 Articles

Calculate Age from given Date of Birth in MySQL?

Rishi Rathor

Rishi Rathor

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

813 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 ... Read More

How do I alter table column datatype on more than 1 column at a time in MySql?

Rishi Rathor

Rishi Rathor

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

71 Views

To add more than 1 column with ALTER table command, you can use MODIFY column command. The syntax is as follows −alter table yourTableName modify column yourColumnName1 dataType, modify column yourColumnName2 dataType, . . . modify column yourColumnNameN dataTypeTo understand the above syntax, let us create a table. The following ... Read More

What is "Processing Symbol Files" message in Xcode?

Rishi Rathor

Rishi Rathor

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

170 Views

Processing symbol files is a message displayed on xcode when we create a project’s build. When this message appears, in background Xcode downloads files and symbol files for specific device and a specific processor on which build shall be installed.The symbol files contains debug symbols which are used to debug ... Read More

Which MySQL type is most suitable for “price” column?

Rishi Rathor

Rishi Rathor

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

18K+ Views

The best type for price column should be DECIMAL. The type DECIMAL stores the value precisely.For Example - DECIMAL(10, 2) can be used to store price value. It means the total digit will be 10 and two digits will be after decimal point.To understand the type DECIMAL, let us create a ... Read More

Find the difference between two timestamps in days with MySQL

Rishi Rathor

Rishi Rathor

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

549 Views

Use DATEDIFF() function from MySQL to get the difference between two timestamps in days.The syntax is as follows −select datediff(yourColumnName1, yourColumnName2) as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The following is the query to create a table −mysql> create table DifferenceTimestamp ... Read More

How add 1 day to Date in swift?

Rishi Rathor

Rishi Rathor

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

9K+ Views

To 1 day to a date in swift we need to create a date first. Once that date is created we have to add specific days to it. In this example we’ll see how we can achieve the same.Let’s create a date first, let it be today, let today = ... Read More

How to programmatically add a UISegmentedControl to a container view?

Rishi Rathor

Rishi Rathor

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

2K+ Views

To add a UISegmentControl in iOS with swift we’ll have to first create a segment control and it’s controller function, i.e. it’s action. Let’s see those steps.Let’s create a function to add a segmented control.func addControl() {    let segmentItems = ["First", "Second"]    let control = UISegmentedControl(items: segmentItems) ... Read More

Can we use str_replace in MySQL?

Rishi Rathor

Rishi Rathor

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

159 Views

The str_replace version in MySQL is the replace() function. Let us first create a table to understand the function −mysql> create table StringReplaceDemo −> ( −> Id int, −> URL varchar(200) −> ); Query OK, 0 rows affected ... Read More

How to parse date in MySQL?

Rishi Rathor

Rishi Rathor

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

1K+ Views

Parse date in MySQL with the help of STR_TO_DATE() function. The syntax is as follows −select str_to_date(yourColumName, ’format’) as anyVariableName from yourTableName;The format in the above syntax is '%d-%b-%y'.Now to understand the above function, let us create a table. The following is the query to create a table −mysql> create ... Read More

MySQL BigInt zerofill vs int zerofill?

Rishi Rathor

Rishi Rathor

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

158 Views

The difference between MySQL BigInt and int is that INT is a 32-bit long while BIGINT is 64-bit long.The following are some of the points −The BigInt takes 8 bytes of storage while int takes 4 bytes of storage.The int takes 4294967295 maximum values for int(10), whereas 18, 446, 744, ... Read More

Advertisements