Insert Multiple Rows in MySQL

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

7K+ Views

Insert multiple rows in MySQL with the help of “values”. You can enclose the values with parentheses set with comma separation. The syntax is as follows to insert multiple rows in MySQL.insert into yourTableName(yourColumnName1, yourColumnName2, ..............yourColumnNameN) values(value1, value2, ...valueN), (value1, value2, ...valueN), (value1, value2, ...valueN), ...........((value1, value2, ...valueN);Let us now first create a table in MySQL −mysql> create table InsertMultipleRowsDemo -> ( -> Id int, -> Name varchar(200), -> Age int -> ); Query OK, 0 rows affected (0.45 sec)Apply the above syntax to insert ... Read More

Format Hour in K-1 24 Format in Java

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

1K+ Views

The “k” format in Java Date is used to format hour in 1-24 format. Use SimpleDateFormat("k") to get the same format.// displaying hour in k format simpleformat = new SimpleDateFormat("k"); String strHour = simpleformat.format(new Date()); System.out.println("Hour in k format = "+strHour);Above, we have used the SimpleDateFormat class, therefore the following package is imported.import java.text.SimpleDateFormat;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More

Difference Between INT(1) and TINYINT(1) in MySQL

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

2K+ Views

The number 1 used in parenthesis is only for width display. The INT(1) and TINYINT(1) does not influence the storage.The TINYINT takes 1 byte that means it has range -128 to +127 while int takes 4 bytes; it has range -2147483648 to +2147483647To understand the width display, let us create a table −mysql> create table intAndTinyint    −> (    −> FirstNumber int(1) zerofill,    −> SecondNumber tinyint(1) zerofill    −> ); Query OK, 0 rows affected (0.52 sec)Now you can insert records in the table. The query is as follows −mysql> insert into intAndTinyint values(1, 1); Query OK, 1 ... Read More

Python Garbage Collector Interface (gc)

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

270 Views

Automatic garbage collection is one of the important features of Python. Garbage collector mechanism attempts to reclaim memory occupied by objects that are no longer in use by the program.Python uses reference counting mechanism for garbage collection. Python interpreter keeps count of number of times an object is referenced by other objects. When references to an object are removed, the count for an object is decremented. When the reference count becomes zero, the object memory is reclaimed.Normally this mechanism is performed automatically. However, it can be done on purpose if a certain situation arises in the program. The 'gc' module ... Read More

Selecting a Single Row in MySQL

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

2K+ Views

If you want to select a single row on the basis of primary key, use the WHERE clause. The syntax is as follows −SELECT * FROM yourTableName WHERE yourPrimaryKeyColumnName = someValue;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table selectWithPrimaryKey    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(20),    -> Age int,    -> Marks int,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command. The query is ... Read More

Unique Ways to Build Your Network When Working Remotely

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

107 Views

Earlier, it was tough that the person who works remotely cannot socialize at all! Neither would his network be broad. It would actually be in the limited domain. However, a person who does not work as a permanent employee does not mean can not have a wide network of acquaintance. He too can have a lot of connections if he takes care of the followings:Make Less But Real RelationshipIn a remote working situation, the interactions require greater effort than the employees who are not the virtual employees. In such circumstances, it is important to make real and genuine relationships. This ... Read More

Resolve Usage of Quotes Error 1064 in MySQL

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

12K+ Views

In MySQL, you can use two different types of quotation marks which is backtick and another is single quotes or double quotes. In this case, maybe you are using single quotes to the column name that’s why you are getting error. You need to use the backtick symbol (` `) instead of single quotes. Backtick can be used with column names while single quotes can be used for strings.To understand the above error, let us create a table. The query to create a table is as follows −mysql> create table Backtick_SymbolDemo    -> (    -> Id int NOT NULL ... Read More

Format Hour in KK 01-24 Format in Java

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

702 Views

The “kk” format in Java Date is used to format hour in 01-24 format. Use SimpleDateFormat("kk") to get the same format.// displaying hour in kk format SimpleDateFormat simpleformat = new SimpleDateFormat("kk"); String strHour = simpleformat.format(new Date()); System.out.println("Hour in kk format = "+strHour);Above, we have used the SimpleDateFormat class, therefore the following package is imported −import java.text.SimpleDateFormat;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More

Select an Empty Result Set in MySQL

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

1K+ Views

Select an empty result set with the help of dummy table ‘dual’ from MySQL. The query is as follows −mysql> select 1 from dual where false; Empty set (0.00 sec)In the above query, “dual” is a dummy table and the above condition false. Therefore, it returns empty set.Let us check with true condition. It will return the selected value. The query is as follows −mysql> select 1 from dual where true;The following is the output −+---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec)

Finding Modules Used by a Python Script using Modulefinder

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

1K+ Views

The ModuleFinder class in 'modulefinder' module can determine set of modules imported by a certain script. This module has a command line interface as well as programmatic interface.For demonstration of functionality, use following script#modfinder.py import hello try: import trianglebrowser import nomodule, mymodule except ImportError: passCommand line interfaceFollowing command displays list of modules located as well as not found.E:\python37>python -m modulefinder modfinder.pyOutputName File ---- ---- m __main__ modfinder.py m hello hello.py m math m trianglebrowser trianglebrowser.py Missing modules: ? mymodule imported from __main__ ? nomodule imported from __main__Programmatic interfaceModuleFinder class in ... Read More

Advertisements