Prabhas has Published 74 Articles

After connecting to MySQL server how can we select a database fromcommand prompt?

Prabhas

Prabhas

Updated on 20-Jun-2020 13:42:08

156 Views

Once we get connected to the MySQL server, it is required to select a database to work with. This is because there might be more than one database available with the MySQL Server.It is very simple to select a database from the mysql> prompt. We can use SQL command ‘use’ ... Read More

How can I get the list of columns from a table in the database we are currently using?

Prabhas

Prabhas

Updated on 20-Jun-2020 13:07:19

123 Views

It can be done with the SHOW COLUMNS statement. Its Syntax would be as follows −SyntaxSHOW COLUMNS FROM tab_nameHere tab_name is the name of the table from which we want to see the list of columns.ExampleIn the example we are getting the list of columns from a table named Student_info ... Read More

What happens if I will prepare the statement with the same name without de-allocating the earlier one?

Prabhas

Prabhas

Updated on 20-Jun-2020 10:56:55

110 Views

Actually, in MySQL, we can prepare a statement with the same name without de-allocating the earlier one because MySQL automatically drops the prepared statements when they are redefined or when we close the connection to the server. In other words, we can say that we can use the same name ... Read More

How can we upload data into MySQL tables by using mysqlimport?

Prabhas

Prabhas

Updated on 20-Jun-2020 10:38:34

341 Views

For uploading the data into MySQL tables by using mysqlimport we need to follow following steps −Step-1 − Creating the tablefirst of all, we need to have a table in which we want to upload the data. We can use CREATE TABLE statement for creating a MySQL table. For example, ... Read More

What happens when I insert the value ‘NULL’ in an AUTO_INCREMENT MySQL column?

Prabhas

Prabhas

Updated on 20-Jun-2020 07:50:04

1K+ Views

When we insert NULL value to AUTO_INCREMENT column, MySQL will return sequence number.Examplemysql> Create table employee(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Name Varchar(10)); Query OK, 0 rows affected (0.16 sec) mysql> Insert into employee(id, Name) values(NULL, 'Gaurav'); Query OK, 1 row affected (0.07 sec) mysql> Select * ... Read More

How to preselect a value in a dropdown list of items in HTML forms?

Prabhas

Prabhas

Updated on 18-Jun-2020 06:01:47

6K+ Views

With HTML, you can easily create a simple drop down list of items to get user input in HTML forms. A select box also called drop down box provides an option to list down various options in the form of drop down list.You can also preselect a value in dropdown ... Read More

How to pass a function as a parameter in Java

Prabhas

Prabhas

Updated on 17-Jun-2020 11:36:16

5K+ Views

Yes. From Java 8 onwards, we can do so using method references.Method references help to point to methods by their names. A method reference is described using "::" symbol. A method reference can be used to point the following types of methods −Static methodsInstance methodsConstructors using new operator (TreeSet::new)Method Reference ... Read More

Advantages and disadvantages of arrays in Java

Prabhas

Prabhas

Updated on 17-Jun-2020 07:50:41

2K+ Views

BenefitsEasier access to any element using the index.Easy to manipulate and store large data.DisadvantagesFixed size. Can not be increased or decrease once declared.Can store a single type of primitives only.

What is the best way to initialize a JavaScript number?

Prabhas

Prabhas

Updated on 17-Jun-2020 06:38:06

726 Views

The best way to initialize a number in JavaScript is to initialize variables while declaring them. Through this, you can easily avoid undefined values.ExampleYou can try to run the following code to initialize a number −Live Demo                    var deptNum = 20, id = 005;          document.write("Department number: "+deptNum);          

Can you have a method in Java with varying number of arguments?

Prabhas

Prabhas

Updated on 16-Jun-2020 09:34:09

2K+ Views

Yes, we can write a method using variable arguments once you use variable arguments as a parameter method while calling you can pass as many numbers of arguments to this method (variable number of arguments) or, you can simply call this method without passing any arguments.ExampleLive Demopublic class Sample{   ... Read More

Advertisements