Karthikeya Boyini has Published 2193 Articles

MySQL command to copy table?

karthikeya Boyini

karthikeya Boyini

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

366 Views

You can achieve this with the help of INSERT INTO SELECT statement. The syntax is as follows −INSERT INTO yourDatabaseName.yourTableName(SELECT *FROM yourDatabaseName.yourTableName);To understand the above syntax, let us create a table in a database and second table in another databaseThe database name is “bothinnodbandmyisam”. Let us create a table in ... Read More

Display Seconds in ss format (01, 02) in Java

karthikeya Boyini

karthikeya Boyini

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

132 Views

The ss format for seconds is like representing seconds 01, 02, 03, 04, etc. We will use it like this.SimpleDateFormat("ss");Let us see an example −// displaying seconds in ss format simpleformat = new SimpleDateFormat("ss"); String strSeconds = simpleformat.format(new Date()); System.out.println("Seconds in ss format = "+strSeconds);Above, we have used the SimpleDateFormat ... Read More

Get the type of a variable in MySQL?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

You cannot get the type of variable in MySQL. Cast the type of variable into another using CAST operator. The syntax is as follows −SET @yourVariableName:=’anyValue’Use the CAST operator to cast to another type. The syntax is as follows −SELECT CAST( @yourVariableName AS SIGNED);To understand the above syntax, let us ... Read More

Implementation of Dynamic Array in Python

karthikeya Boyini

karthikeya Boyini

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

14K+ Views

Dynamic ArrayIn python, a list, set and dictionary are mutable objects. While number, string, and tuple are immutable objects. Mutable objects mean that we add/delete items from the list, set or dictionary however, that is not true in case of immutable objects like tuple or strings.In python, a list is ... Read More

Display TimeZone in zzzz format in Java

karthikeya Boyini

karthikeya Boyini

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

358 Views

Use the zzzz format like this for TimeZone.SimpleDateFormat("zzzz");Let us see an example −// displaying timezone in zzzz format simpleformat = new SimpleDateFormat("zzzz"); String strTimeZone = simpleformat.format(new Date()); System.out.println("TimeZone in zzzz format = "+strTimeZone);Above, we have used the SimpleDateFormat class, therefore the following package is imported −import java.text.SimpleDateFormat;The following is an ... Read More

Python program to print all the numbers divisible by 3 and 5 for a given number

karthikeya Boyini

karthikeya Boyini

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

20K+ Views

This is a python program to print all the numbers which are divisible by 3 and 5 from a given interger N. There are numerous ways we can write this program except that we need to check if the number is fully divisble by both 3 and 5.Below is my ... Read More

Format Year in yyyy format in Java

karthikeya Boyini

karthikeya Boyini

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

376 Views

To format year in yyyy format is like displaying the entire year. For example, 2018.Use the yyyy format like this −SimpleDateFormat("yyyy");Let us see an example −// year in yyyy format SimpleDateFormat simpleformat = new SimpleDateFormat("yyyy"); String strYear = simpleformat.format(new Date()); System.out.println("Current Year = "+strYear);Above, we have used the SimpleDateFormat class, ... Read More

How to display Java Runtime Environment (JRE) version

karthikeya Boyini

karthikeya Boyini

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

764 Views

Use the System.getProperty() method in Java to get the Java Runtime Environment.It’s syntax is −String getProperty(String key)Above, the key is the name of the system property. Since, we want the Java Runtime Environment name, therefore we will add the key as −java.versionThe following is an example −Example Live Demopublic class Demo ... Read More

Why is “LIMIT 0” even allowed in MySQL SELECT statements?

karthikeya Boyini

karthikeya Boyini

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

953 Views

As you know if you use LIMIT 0 in MySQL SELECT statement, it returns an empty set.The LIMIT can be used when you want a specified number of rows from a result rather than the entire rows. If you use any MySQL API, then the job of LIMIT is to ... Read More

Display path separator in Java

karthikeya Boyini

karthikeya Boyini

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

203 Views

To display the path separator, use the Properties class and import the following package −import java.util.Properties;Use the getProperties() method first and create an object −Properties p = System.getProperties();Now, set the key for path separator −p.getProperty("path.separator")The following is an example −Example Live Demoimport java.util.Properties; public class Demo { public ... Read More

Advertisements