Change value from 1 to Y in MySQL Select Statement?

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

98 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

How to bulk update MySQL data with a single query?

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

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

How to use the front camera in Swift?

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

852 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

406 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 (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

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

92 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

Cops pack off critic Kathi Mahesh for making insulting remarks against Lord Ram?

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

25 Views

In a historic decision, the Telangana Police has banished the controversial Telugu film critic Kathi Mahesh from Hyderabad for six months. The derogatory remarks against Lord Sriram by Kathi has led to law and order crisis, and police feared even the arrest may trigger more unrest. So, the police have decided to extern him from the state capital and pack him off to his native in Andhra Pradesh, the Chittoor district.Police have also initiated action against a popular Telugu TV channel, for violating Cable TV networks (Regulation) Act. The named channel has repeated Mahesh's controversial remarks again and again which ... Read More

How can India create more salaried jobs?

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

29 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

What procedure does one need to follow if traveling through metro rail for the first time?

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

2K+ Views

Metro rail is one of the quickest and the cheapest modes of travel. As the name suggests, it is available in the leading metropolitan cities like Delhi, Mumbai, Banglore, Jaipur, Gurgaon, Noida etc. It's quite obvious that the first-timers have no clue about the DOs and DONTs while traveling in a metro, here are some tips:Purchase Your Token or Metro CardFirst of all, buy a token or a ticket from a counter. You can also generate a token from the machines present on all metro stations nowadays. If you are planning to travel frequently by metro, better you go for ... Read More

Advertisements