To select last few days, use DATE_ADD() function in MySQL. The syntax is as follows −select date_add(curdate(), interval - anyIntgegerValue day);Or you can DATE_SUB() from MySQL.select date_sub(curdate(), interval anyIntgegerValue day);Or you can use the following syntax −select curdate() - interval anyIntgegerValue day;Here is the example of all syntaxes shown above to select last few days.Case 1 − Use of DATE_ADD() functionThe query is as follows −mysql> select date_add(curdate(), interval -6 day);Here is the output −+-------------------------------------+ | date_add(curdate(), interval -6 day) | +-------------------------------------+ | 2018-11-20 | +-------------------------------------+ 1 row ... Read More
To do select into in MySQL, use CREATE TABLE SELECT command. The syntax is as follows −CREATE TABLE yourTableName SELECT *FROM yourOriginalTableName;To understand, let us first create a table −mysql> create table SelectIntoDemo -> ( -> Id int, -> Name varchar(200) -> ); Query OK, 0 rows affected (0.50 sec)Let us insert some records into the table with the help of insert command. The query is as follows −mysql> insert into SelectIntoDemo values(1, 'Bob'), (2, 'Carol'), (3, 'David'); Query OK, 3 rows affected (0.15 sec) Records: 3 Duplicates: 0 Warnings: 0Displaying all records with the help of select statement. The ... Read More
To check whether a field is null or empty in MySQL, use the IF() function in MySQL. The syntax is as follows −SELECT IF(yourColumnName IS NULL or yourColumnName = '', 'NULLId', yourColumnName) 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 NullAndEmptyDemo -1> ( -> Id varchar(200) -> ); Query OK, 0 rows affected (0.66 sec)Let us now insert records into the table with the help of insert command. The query to insert records in the table is as follows. We have added null ... Read More
Errors and Error DetectionWhen bits are transmitted over the computer network, they are subject to get corrupted due to interference and network problems. The corrupted bits leads to spurious data being received by the receiver and are called errors.Error detection techniques are responsible for checking whether any error has occurred or not in the frame that has been transmitted via network. It does not take into account the number of error bits and the type of error.For error detection, the sender needs to send some additional bits along with the data bits. The receiver performs necessary checks based upon the ... Read More
Interleaving is a tool that is used to enhance existing error correcting codes so that they can be used to perform burst error corrections as well.Most error correcting codes (ECCs) are designed to correct random errors, i.e. error caused by additive noise that is independent of each other. Burst error are the errors that occur in a sequence or as groups. They are caused due to defects in storage media or disruption in communication signals due to external factors like lightning etc. Interleaving modifies the ECC or does some processing on the data after they are encoded by ECCs.Interleaving ProcedureDuring ... Read More
Career prospects in the VFX (Visual Effects) industry are enormous, especially in a country like India which not only has a huge domestic market for VFX-enriched content in its mass media entertainment programs but is also a massive base for VFX job work for the global entertainment industry.The Right SoilIndia has the right eco-system to provide high-quality VFX output at an affordable cost and at scale. VFX requires the animators to be creative, imaginative, skilled in application software and willing to work long hours and at wages that very few other countries can match. So, yes, the opportunities in VFX ... Read More
This example demonstrate about How to print exception messages in android.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 textview to show exception message.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class MainActivity extends AppCompatActivity ... Read More
This example demonstrate about How to merge two arrays without duplication in android listview.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 code, we have taken listview to show array values.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; public class MainActivity extends AppCompatActivity { ... Read More
Unique in MySQL means we cannot add duplicate records. Let us now see how to create a unique constraint in the column at the time of creating a table.mysql> create table UniqueConstDemo - > ( - > name varchar(100) unique - > ); Query OK, 0 rows affected (0.72 sec)Now, we cannot have same value more than once for column ‘name’.Inserting some records with duplicate values to check the error.mysql> insert into UniqueConstDemo values('John'); Query OK, 1 row affected (0.19 sec) mysql> insert into UniqueConstDemo values('John');On running the above query, the following error is visible.mysql> insert into UniqueConstDemo values('John'); ... Read More
This example demonstrate about How to insert integer array in android listview.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 code, we have taken listview to show integer array.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class MainActivity extends AppCompatActivity { ListView list; int[] array ... Read More