How to find out number of days in a month in MySQL?

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

5K+ Views

To find the number of days in month, use the below syntax.select DAY(LAST_DAY(yourColumnName)) as anyVariableName from yourTableName;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table DaysInaGivenMonth -> ( -> MonthName datetime -> ); Query OK, 0 rows affected (1.62 sec)Insert some records in the table using insert command. The query is as follows.mysql> insert into DaysInaGivenMonth values(now()); Query OK, 1 row affected (0.24 sec) mysql> insert into DaysInaGivenMonth values(date_add(now(), interval -1 month)); Query OK, 1 row affected (0.16 sec) mysql> insert into DaysInaGivenMonth values(date_add(now(), interval ... Read More

Why don't we create green top pitches in India?

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

502 Views

India-West Indies Test Series is starting from today and so is the debate over green-tops. Undoubtedly, India is a very strong side and have the ability to beat any ferocious opponent on the ground, especially when they play on their home grounds, in India, and in favorable conditions. Similarly, we all know how these home tigers suffer when they land out of the subcontinent. They crash every record of the poor game and impetrate to win a single match out of a series of five.This is what we witnessed in England recently. Not only this time but every time we ... Read More

MySQL update query to remove spaces between letters?

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

3K+ Views

If you have spaces between letters then you can use REPLACE() function to remove spaces.The syntax is as follows −UPDATE yourTableName SET yourColumnName=REPLACE(yourColumnName, ’ ‘, ’’);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table removeSpaceDemo -> ( -> Id int NOT NULL AUTO_INCREMENT, -> UserId varchar(20), -> UserName varchar(10), -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (0.81 sec)Now insert some records in the table using insert ... Read More

8085 program to find 1's and 2's complement of 16-bit number

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

3K+ Views

In this program we will see how to find 1's complement and 2's complement of a 16-bit number.Problem StatementWrite 8085 Assembly language program to find 1's complement and 2's complement of a16-bit number stored in 8000H and 8001H.Discussion8085 has an instruction CMA. This instruction complements the content of Accumulator. For 1's complement CMA instruction is sufficient, and for 2's complement we have to increase the number by 1 after complementing.For 16-bit number, we are taking the number into HL pair, but for complementing we have to copy the numbers to Accumulator from H and L one by one. Then by ... Read More

How to get the absolute coordinates of a view in Android?

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

5K+ Views

Before getting into example, we should know what is absolute coordinates. It means absolute position (x, y)of a view on window manager. This example demonstrate about how to get the absolute coordinates of a view.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 xml, we have given one Textview. when user click on textview, it will show the position of the view on Toast.Step 3 − Add the following ... Read More

What is the Babinet's principle which is the basic for Slot Antenna?

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

4K+ Views

Babinet’s Principle is actually the principle used in optics. According to its definition, “When the field behind a screen with an opening is added to the field of a complementary structure, the sum is equal to the field when there is no screen”The images clearly explain the principle. In all the regions, which are non-collinear with the beam, the above two screens, in figure 1 & 2, produce the same diffraction pattern.Case1Consider a light source and a conducting plane (field) with an aperture before a screen. The light does not pass through the opaque area but passes through the aperture.Case2Consider ... Read More

How to implement Android TextInputLayout

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

3K+ Views

Before getting into example, we should know what is TextInputLayout in android. TextInputLayout is extended by Linear Layout. It going to act as a wrapper for edit text and shows flatting hint animation for edit text.This example demonstrate about how to implement Android TextInputLayout.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 ... Read More

8085 program to find 2's complement of the contents of Flag Register

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

490 Views

In this program we will see how to find 2's complement of the content of flag register.Problem StatementWrite 8085 Assembly language program to find 2's complement of the content of flag register.DiscussionWe cannot access the total flag register directly. To use them we have to push the PSW(Accumulator-Flag) into stack, and then pop it to another register pair, then after complementing the LS byte of that register pair, we have to push it again into the stack, and then pop it to PSW  to get it into Flag bits.InputHere we are not putting any input directly. If the flag bits ... Read More

How to make Two activities with different colored status bar in Android.

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

726 Views

There are so many situations, where we need to change the different action bar colors according toproject requirement . This example demonstrate about how to make Two activities with different colored status bar.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 created on button when you click on button it going to call second activity.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import ... Read More

Remove first two characters of all fields in MySQL?

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

1K+ Views

To remove the first two characters of all fields, you need to use SUBSTRING() function from MySQL. The syntax is as follows −UPDATE yourTableName SET yourColumnName=SUBSTRING(yourColumnName, 3) WHERE yourCondition;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table RemoveFirstTwoCharacterDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> StringValue varchar(30),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (1.04 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into RemoveFirstTwoCharacterDemo(StringValue) values('U:100'); Query OK, 1 ... Read More

Advertisements