Rishi Rathor has Published 142 Articles

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

Rishi Rathor

Rishi Rathor

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

24K+ 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

725 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

13K+ 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

245 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

2K+ 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

282 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

How to substring value in a MySQL table column?

Rishi Rathor

Rishi Rathor

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

283 Views

To substring a MySQL table column, use the in-built SUBSTR() function from MySQL. The syntax is as follows −select substr(yourColumnName, AnyValue) as anyVariableName from yourTableName;To understand the function substr(), let us create a table. The query to create a table is as follows −mysql> create table SubStringDemo ... Read More

Program to Find the largest number in an array of data in 8085 Microprocessor

Rishi Rathor

Rishi Rathor

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

25K+ Views

In this program we will see how to find the largest number from a block of bytes using 8085.Problem StatementWrite 8085 Assembly language program to find the largest number from a block of bytes.DiscussionIn this program the data are stored at location 8001H onwards. The 8000H is containing the size ... Read More

8085 program to add two 16 bit numbers

Rishi Rathor

Rishi Rathor

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

18K+ Views

In this program we will see how to add two 16-bit numbers.Problem StatementWrite8085 Assembly language program to add two 16-bit number stored in memory location 8000H – 8001H and 8002H – 8003H.DiscussionIn this program we are pointing the operand addresses using HL and DE register pair. Then adding LSBytes by ... Read More

Advertisements