Articles on Trending Technologies

Technical articles with clear explanations and examples

Changing year in MySQL date?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 5K+ Views

To change the year in MySQL date, you need to use DATE_FORMAT() function with UPDATE command. The syntax is as follows.UPDATE yourTableName SET yourDateColumnName = DATE_FORMAT(yourDateColumnName ,'yourYearValue-%m-%d');To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table ChangeYear    -> (    -> id int not null auto_increment,    -> ArrivalTime date,    -> PRIMARY KEY(id)    -> ); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into ChangeYear(ArrivalTime) values(date_add(now(), interval -2 year)); Query OK, 1 row affected, 1 warning ...

Read More

What happens if it rains in the desert?

Samrat T
Samrat T
Updated on 30-Jul-2019 882 Views

There are many interesting answers to this question. But I found one very fascinating and amazing phenomenon. When it rains suddenly in the Atacama desert in Chile, which is the driest non-polar desert on Earth, there will be a sudden spur of life in the desert.If the desert gets heavy rainfall during their spring season which is October and November, there will be a sudden bloom of the flowers ‘hibernating’ beneath its surface. It fills the entire desert with an explosion of color by the flowers coming to their full bloom which is eagerly waiting for the rain, leaving the place ...

Read More

How to find nth highest value of a MySQL column?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 755 Views

To find the nth highest value of a column, you need to use ORDER BY DESC with LIMIT clause. If you want the second highest value of a column, use the below syntax:SELECT *FROM yourTableName ORDER BY DESC yourColumnName LIMIT 1, 1;If you want the fourth highest value of a column, use the below syntax:SELECT *FROM yourTableName ORDER BY DESC yourColumnName LIMIT 3, 1;If you want the first highest value of a column, use the below syntax:SELECT *FROM yourTableName ORDER BY DESC yourColumnName LIMIT 1;As discussed in the above syntax, you need to change only in LIMIT clause. To understand ...

Read More

Delete all the records from a MySQL table?

Vrundesha Joshi
Vrundesha Joshi
Updated on 30-Jul-2019 1K+ Views

To delete all the records from a MySQL table, you can use the TRUNCATE statement.The syntax is as follows −TRUNCATE TABLE yourTableName;The above syntax deletes all the records from the table. To understand the above syntax, let us create a table. The following is the query to create a table −mysql> create table DeleteAllFromTable −> ( −> PersonId int, −> PersonName varchar(200) −> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table with the help of insert command.The query is as follows −mysql> insert ...

Read More

How to set sql_mode permanently in MySQL?

George John
George John
Updated on 30-Jul-2019 1K+ Views

If you are using Windows Operating System, check your directory my.cnf or my.ini file.mysql> select @@datadir;The following is the output+---------------------------------------------+ | @@datadir | +---------------------------------------------+ | C:\ProgramData\MySQL\MySQL Server 8.0\Data\ | +---------------------------------------------+ 1 row in set (0.00 sec)Reach the above location ‘C:\ProgramData\MySQL\MySQL Server 8.0\Data\”. The screenshot is as follows for my.cnf fileOpen the my.cnf file and write the sql_mode="TRADITIONAL". The syntax is as followssql_mode="TRADITIONAL".After that start your server once again.

Read More

Is engineering really losing its worth by the time?

Madhuparna
Madhuparna
Updated on 30-Jul-2019 383 Views

Yes, engineering has indeed lost its value over the years. Given that there are several engineering colleges in India and umpteen engineers are being produced each year from these colleges. However, the question is, if India needs so many engineers and if they are all good to be employed why they have trouble in getting jobs. These questions have automatically created negativity against engineering education in India.Bangalore city alone has over 130 engineering colleges, but the employable engineering graduates are only 22% of engineering jobs (according to studies by MHRD a few years back).Decreasing employer satisfaction with fresh engineering graduates. ...

Read More

How to remove special characters from a database field in MySQL?

George John
George John
Updated on 30-Jul-2019 21K+ Views

You can remove special characters from a database field using REPLACE() function. The special characters are double quotes (“ “), Number sign (#), dollar sign($), percent (%) etc.The syntax is as follows to remove special characters from a database field.UPDATE yourTableName SET yourColumnName=REPLACE(yourColumnName, ’yourSpecialCharacters’, ’’);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table RemoveSpecialCharacterDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(20),    -> PRIMARY Key(Id)    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using ...

Read More

MYSQL select DISTINCT values from two columns?

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 5K+ Views

To select distinct values in two columns, you can use least() and greatest() function from MySQL.Let us create a table with two columns −mysql> create table SelectDistinctTwoColumns    −> (    −> StudentId int,    −> EmployeeId int    −> ); Query OK, 0 rows affected (0.60 sec)Now you can insert records in the table. The query to insert records is as follows −mysql> insert into SelectDistinctTwoColumns values(100, 101); Query OK, 1 row affected (0.39 sec) mysql> insert into SelectDistinctTwoColumns values(102, 103); Query OK, 1 row affected (0.13 sec) mysql> insert into SelectDistinctTwoColumns values(104, 105); Query OK, 1 ...

Read More

How to make iPhone vibrate using Swift?

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 2K+ Views

To make an iPhone vibrate using swift we’ll use two different methods. First create a new project and add Four different buttons to the main View controller.Now import the AudioToolbox framework in your view controller class.For the first button add an action and write the following code as shown below:@IBAction func actionButtonOne(_ sender: Any) {    AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) }This will generate a long vibrating feedback on your device. Now to create more vibration effects on devices with iOS 10 or more we’ll add methods for all four different buttons.@IBAction func actionButtonTwo(_ sender: Any) {    let generator = UIImpactFeedbackGenerator(style: .heavy)   ...

Read More

What are the basic responsibilities you have for your country?

Ridhi Arora
Ridhi Arora
Updated on 30-Jul-2019 2K+ Views

'India is my country and all Indians are my brothers and sisters.' This is the oath we used to take every day when we were in school. This pledge and many more books and texts remind us of our moral and legal responsibilities. Our nation is our motherland. It never asks anything in return from us as it is our motherland and a mother is selfless in giving.Even if the nation does not expect anything from us, we hold an obligation ourselves.The first and foremost responsibility we have towards our country is to respect not only the land where we ...

Read More
Showing 60281–60290 of 61,297 articles
Advertisements