How to convert Varchar to Double in SQL?

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

5K+ Views

You can convert varchar to double using CAST() function. The syntax is as follows:SELECT yourColumnName1, yourColumnName2, ......N, CAST(yourColumnName AS DECIMAL(TotalDigit, DigitAfterDecimalPoint)) anyVariableName FROM yourtableName ORDER BY anyVariableName DESC;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table VarcharToDouble    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(10),    -> Amount varchar(10) ,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command. The query is as follows:mysql> insert into VarcharToDouble(Name, Amount) values('John', ... Read More

How to create NSIndexPath for TableView in iOS?

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

975 Views

Index path is generally a set of two values representing row and section of a table view. Index path can be created in objective C as well as Swift as both are native language of iOS Development.IndexPathForRow is a class method in iOS. To create a index path we need to be sure about the section and row we need to create. Below are the methods of creating an Indexpath.To create an IndexPath in objective C we can use.NSIndexPath *myIP = [NSIndexPath indexPathForRow: Int inSection:Int] ;ExampleNSIndexPath *myIP = [NSIndexPath indexPathForRow: 5 inSection: 2] ;To create an IndexPath in Swift we ... Read More

Who has delivered the fastest ball in the history of cricket?

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

689 Views

When we hear the fastest ball, the fierce faces of all fast bowlers and their tough looks start striking our mind. It includes Wasim Akram, Courtney Walsh, Chaminda Vaas, Umar Gul, etc. But the question still remains unanswered that who among the fast bowler fraternity has done this miracle.Well, the answer is Shoaib Akhtar who is recognized as the fastest bowler in the history of cricket by delivering an officially recorded top speed of 163.3 km/h in a pool match against England during the 2003 Cricket World Cup. Unfortunately, Akhtar did not get any wicket on the ball.Fastest Recorded Deliveries ... Read More

What is a sonnet in English literature?

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

630 Views

A small lyric poem of fourteen lines is a sonnet. There are two types of Sonnets: the Italian (Petrarchan) and the English (Shakespearean).In the Italian form, There are two intrinsic divisions: the first part consists of 8 lines and the second part is of 6 lines, in all making 14 lines.Shakespearian SonnetsBut the same does not happen in Shakesperian sonnets. William Shakespeare, the ‘Bard of Avon’, is noted to have mastered at least 38 plays, 154 sonnets, two long narrative poems, and a few other verses. His popularity can be estimated by the following “He was naturally learned; he needed ... Read More

MySQL - Changing year of dates from 2020 to 2011?

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

600 Views

You can change year of dates from 2020 to 2011 using SUBDATE() with INTERVAL of 9 year because there is a difference of 9 years between 2020 to 2011.The syntax is as follows:UPDATE yourTableName SET yourDateColumnName=SUBDATE(yourDateColumnName, INTERVAL 9 YEAR);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table ChangeYearFrom2020To2011    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> ExpiryDate date,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command. The query to insert ... Read More

How do I programmatically "restart" an Android app?

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

3K+ Views

There are some situations, we need to restart whole application programmatically. This example demonstrates how do I programmatically “restart” an Android app.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 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view. When the user clicks on text view, it will restart the whole application.package com.example.andy.myapplication; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; ... Read More

Negative Binary Numbers

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

18K+ Views

Negative numbers can be distinguishable with the help of extra bit or flag called sign bit or sign flag in Binary number representation system for signed numbers. It is not possible to add minus or plus symbol in front of a binary number because a binary number can have only two symbol either 0 or 1 for each position or bit. That’s why we use this extra bit called sign bit or sign flag. The value of sign bit is 1 for negative binary numbers and 0 for positive numbers.When an integer binary number is positive, the sign is represented ... Read More

Why MySQL NOT NULL shouldn't be added to primary key field?

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

945 Views

You do not need to add NOT NULL to primary key field because it gets NOT NULL automatically. Primary key is combination of both NOT NULL and Unique Key.Here is the demo of primary key field. Let us first create a table. The query to create a table is as follows:mysql> create table NotNullAddDemo    -> (    -> Id int AUTO_INCREMENT,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.81 sec)In the above table, you do not need to add NOT NULL to primary key field because MySQL internally converts it into NOT NULL. To ... Read More

Getting last 5 character of a string with MySQL query?

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

20K+ Views

To get the first n characters of string with MySQL, use LEFT(). To get the last n char of string, the RIGHT() method is used in MySQL.The syntax for RIGHT() method is as follows −SELECT RIGHT(yourColumnName, valueOfN) as anyVariableName from yourTableName;To understand the above concept, let us create a table. The query to create a table is as follows −mysql> create table gettingLast5Characters    −> (    −> BookName varchar(100)    −> ); Query OK, 0 rows affected (0.73 sec)Now you can insert records in the table using insert command. The query is as follows −mysql> insert into gettingLast5Characters values('Introduction ... Read More

What is the order of events of Republic day celebration at Red Fort?

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

998 Views

Republic day in India is celebrated on 26th of January every year and holds a seminal value. The day is celebrated in grandeur in the capital city's India Gate. Various events take place in the capital city and elsewhere to celebrate the framing of the Indian Constitution.Order of Events On Republic DayPrime Minister lays a floral wreath at Amar Jawan Jyoti. It is an Indian memorial constructed post the Indo-Pakistani War of 1971 to commemorate the martyred soldiers of the Indian Armed Forces who died during the war.President along with his bodyguards proceeds to the parade ground in Red Fort. ... Read More

Advertisements