Change Value from 1 to y in MySQL SELECT Statement

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

216 Views

You can use IF() from MySQL to change value from 1 to Y. The syntax is as follows:SELECT IF(yourColumnName, ’Y’, yourColumnName) as anyVariableName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table changeValuefrom1toY    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> isValidAddress tinyint(1),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.76 sec)Now you can insert some records in the table using insert command. The query is as follows:mysql> insert into changeValuefrom1toY(isValidAddress) values(1); Query OK, 1 row affected (0.22 ... Read More

Bulk Update MySQL Data with a Single Query

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

7K+ Views

You can bulk update MySQL data with one query using CASE command. The syntax is as follows −update yourTableName set yourUpdateColumnName = ( Case yourConditionColumnName WHEN Value1 THEN ‘’UpdatedValue’ WHEN Value2 THEN ‘UpdatedValue’ . . N END) where yourConditionColumnName IN(Value1, Value2, .....N);To understand the above concept, let us create a table. The query to create a table is as follows −mysql> create table UpdateAllDemo −> ( −> BookId int, −> BookName varchar(200) −> ); Query OK, 0 rows affected (1.18 sec)Insert some records in the table using insert ... Read More

Use the Front Camera in Swift

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

1K+ Views

To use the front camera in swift we first need to get a list of cameras available in the device we are using. In this article we’ll see how to get the list of devices and then check if the front camera is available or not. We’ll do it in a series of steps.Import AVFoundationCheck if the list of cameras existsFilter out the front camera if exists.guard let frontCamera = AVCaptureDevice.devices().filter({ $0.position == .front }) .first as? AVCaptureDevice else { fatalError("Front camera not found") }The devices() method of AVCapture returns the list of cameras available. From that ... Read More

Get the First Element from a Sorted Set in Java

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

586 Views

To create a Sorted Set, firstly create a Set.Set s = new HashSet();Add elements to the above set.int a[] = {77, 23, 4, 66, 99, 112, 45, 56, 39, 89}; Set s = new HashSet(); try { for(int i = 0; i < 5; i++) { s.add(a[i]); }After that, use TreeSet class to sort.TreeSet sorted = new TreeSet(s);Get the first element, using the first() method −System.out.println("First element of the sorted set = "+ (Integer)sorted.first());The following is the code to get the first element from a Sorted Set ... Read More

Positive Acknowledgement with Retransmission in PAR

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

2K+ Views

Positive Acknowledgement with Retransmission (PAR) is a group of error – control protocols for transmission of data over noisy or unreliable communication network. These protocols reside in the Data Link Layer and in the Transport Layer of the OSI (Open Systems Interconnection) reference model. They provide for automatic retransmission of frames that are corrupted or lost during transit. PAR is also called Automatic Repeat ReQuest (ARQ).PARs are used to provide reliable transmissions over unreliable upper layer services. They are often used in Global System for Mobile (GSM) communication.Working PrincipleIn these protocols, the receiver sends an acknowledgement message back to the ... Read More

Demonstrate Constructors in a Multilevel Hierarchy in Java

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

2K+ Views

Multilevel inheritance is when a class inherits a class which inherits another class. An example of this is class C inherits class B and class B in turn inherits class A.A program that demonstrates constructors in a Multilevel Hierarchy in Java is given as follows:Example Live Democlass A {    A() {       System.out.println("This is constructor of class A");    } } class B extends A {    B() {       System.out.println("This is constructor of class B");    } } class C extends B {    C() {       System.out.println("This is constructor of class C"); ... Read More

Change Value from 1 to Y in MySQL Select Statement Using CASE

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

164 Views

You can use CASE from MySQL to change value from 1 to Y. Let us first create a table. The query to create a table is as follows:mysql> create table changeValuefrom1toY    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> isValidAddress tinyint(1),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.76 sec)Now you can insert some records in the table using insert command. The query is as follows:mysql> insert into changeValuefrom1toY(isValidAddress) values(1); Query OK, 1 row affected (0.22 sec) mysql> insert into changeValuefrom1toY(isValidAddress) values(0); Query OK, 1 row affected (0.16 sec) mysql> insert ... Read More

How India Can Create More Salaried Jobs

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

92 Views

India is a developing country. Got bored of hearing this again and again, right? For it to be a well-developed country, India needs to focus more on developing its economic status. India has less than one-fifth of workers who are in salaried employment.More job creation would boost up India’s rank in Global Prosperity ladder. India is still in lower middle-income status which needs some salaried jobs to boost its status. The economic survey 2017-18 says if the per capita income in India grows at 6.5% per year, India would reach upper-middle-income status by the mid-to-late 2020s.In my view, a few ... Read More

Get Last Entry from NavigableMap in Java

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

198 Views

To display the last entry from NavigableMap in Java, use the lastEntry() method.Let us first create NavigableMap.NavigableMap n = new TreeMap(); n.put("A", 498); n.put("B", 389); n.put("C", 868); n.put("D", 988); n.put("E", 686); n.put("F", 888); n.put("G", 999); n.put("H", 444); n.put("I", 555); n.put("J", 666);Get the last entry now.n.lastEntry()The following is an example to get the last entry from NavigableMap.Example Live Demoimport java.util.*; public class Demo { public static void main(String[] args) { NavigableMap n = new TreeMap(); n.put("A", 498); n.put("B", 389); ... Read More

Variable in Subclass Hides the Variable in Super Class in Java

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

447 Views

Sometimes the variable in the subclass may hide the variable in the super class. In that case, the parent class variable can be referred to using the super keyword in Java.A program that demonstrates this is given as follows:Example Live Democlass A {    char ch; } class B extends A {    char ch;    B(char val1, char val2) {       super.ch = val1;       ch = val2;    }    void display() {       System.out.println("In Superclass, ch = " + super.ch);       System.out.println("In subclass, ch = " + ch);    } ... Read More

Advertisements