How to get an age from a D.O.B field in MySQL?

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

5K+ Views

To get age from a D.O.B field in MySQL, you can use the following syntax. Here, we subtract the DOB from the current date.select yourColumnName1, yourColumnName2, ........N, year(curdate())- year(yourDOBColumnName) 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 AgeDemo -> ( -> StudentId int, -> StudentName varchar(100), -> StudentDOB date -> ); Query OK, 0 rows affected (0.61 sec)Insert some records in the table using insert command. The query is as follows.mysql> insert into AgeDemo values(1, 'John', '1998-10-1'); Query OK, 1 ... Read More

How does the Microstrip antenna work?

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

2K+ Views

Microstrip antennas are the low-profile antennas. A metal patch mounted on a ground level with a dielectric material in-between constitutes a Microstrip or Patch Antenna. These are very low size antennas having low radiation. The patch antennas are popular for low profile applications at frequencies above 100MHz.Construction and workingThe microstrip consists of a very thin metallic strip placed on a ground plane with a dielectric material in-between. The radiating element and feed lines are placed by the process of photo-etching on the dielectric material. Usually, the patch or microstrip is chosen to be square, circular or rectangular in shape for ... Read More

How to Stop EditText from gaining focus at Activity startup in Android

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

2K+ Views

There are so many situations where we don't required keyboard visibility when activity starts. This example demonstrate about how to Stop EditText from gaining focus at Activity startupStep 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 given on Edit Text. By Default it contains request focus.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.EditText; public class MainActivity extends ... Read More

Explain the working of a turbojet engine.

Shanmukh Pasumarthy
Updated on 30-Jul-2019 22:30:24

3K+ Views

A turbojet engine is used in Aircraft. These are air-breathing engines which suck in air from the atmosphere for combustion. It has various components like inlet, compressor, combustion chamber, turbines, and nozzle. Air is drawn into the turbojet engine, compressed, mixed with fuel, and burned continuously.The exhaust product of this burning operates the turbine for the compressor, producing thrust which propels the aircraft. Turboprops are used in smaller and slow-paced air crafts as turbojets are not efficient at low speeds whereas turbofans have better specific fuel consumption than the turbojet. These engines are generally installed below the wings or near ... Read More

8085 program to check whether the given number is even or odd

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

11K+ Views

In this program we will see how to check whether a number is odd or even.Problem StatementWrite 8085 Assembly language program to check whether a number is odd or even.DiscussionThe Odd Even checking is very simple. we can determine one number is odd or even by checking only the LSb. When LSb is 1, the number is odd, otherwise it is even.In this program we are taking a number from memory and then ANDing 01H with it. if the result is nonzero, then the number is odd,  otherwise it is even.Inputfirst inputAddressData......800015......second inputAddressData......80002C......Flow DiagramProgramAddressHEX CodesLabelMnemonicsCommentsF0003A, 00, 80LDA 8000HLoad the number ... Read More

How to switch between hide and view password in Android

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

2K+ Views

There are so many cases, it required to show password while entering password or after entered password. This example demonstrate about How to switch between hide and view password.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 given two TextInputEditText ... Read More

Can we use IFNULL along with MySQL ORDER BY?

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

457 Views

You can use IFNULL along with ORDER BY clause. The syntax is as follows −SELECT *FROM yourTableName ORDER BY IFNULL(yourColumnName1, yourColumnName2);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table IfNullDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> ProductName varchar(10),    -> ProductWholePrice float,    -> ProductRetailPrice float,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (1.19 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into IfNullDemo(ProductName, ProductWholePrice, ProductRetailPrice) values('Product-1', 99.50, ... Read More

Count number of rows in each table in MySQL?

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

4K+ Views

To get the count of rows, you need to use information_schema.tables. The syntax is as follows.SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ‘yourDatabaseName’;Let us implement the above syntax for a database with the name ‘test’. The query is as follows displaying the table names with the count of rows in the table.mysql> SELECT table_name, table_rows -> FROM INFORMATION_SCHEMA.TABLES -> WHERE TABLE_SCHEMA = 'test';The following is the output.+------------------------------------+------------+ | TABLE_NAME | TABLE_ROWS | +------------------------------------+------------+ | _student_trackerdemo | 0 | | _studenttrackerdemo | 0 | | add30minutesdemo | 0 | | addcolumn | 0 | ... Read More

How to insert data to MySQL having auto incremented primary key?

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

3K+ Views

Whenever your column has an auto incremented primary key then there is an advantage that you do not need to give value for that column in the INSERT command. This means MySQL will give the value for that column.To understand the above concept, let us first create a table. The query to create a table is as follows −mysql> create table AutoIncrementedPrimary    -> (    -> Id int auto_increment,    -> Name varchar(100),    -> Age int,    -> Primary key(Id)    -> ); Query OK, 0 rows affected (0.56 sec)Now insert records for the column Name and Age ... Read More

8085 program to find maximum and minimum of 10 numbers

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

2K+ Views

In this program we will see how to find the maximum and minimum number in a block data.Problem StatementWrite 8085 Assembly language program to find the maximum and minimum number in a block often 8-bit numbers.DiscussionIn this program we are taking the first number of the block into register D and E. The D will store the minimum number, and E will store maximum number. In each iteration we will check whether the number is smaller than D or not, if it is smaller, then update D with the new number, and then compare it again with E to check ... Read More

Advertisements