Skip to main content

How to insert multiple entry or row in SQL

insert multiple row in SQL is very easy. don't worry about it.

mysql> create table orders(orderid varchar(10), customerid varchar(10), orderdate varchar(10));
Query OK, 0 rows affected (0.02 sec)

mysql> desc orders;
+------------+-------------+------+-----+---------+-------+
| Field      | Type        | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| orderid    | varchar(10) | YES  |     | NULL    |       |
| customerid | varchar(10) | YES  |     | NULL    |       |
| orderdate  | varchar(10) | YES  |     | NULL    |       |
+------------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)

mysql> insert into orders(orderid,customerid,orderdate) values ('10308', '2', '1996-09-18'), ('10309', '37', '1996-09-19'), ('10310', '77', '1996-09-20');
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select * from orders;
+---------+------------+------------+
| orderid | customerid | orderdate  |
+---------+------------+------------+
| 10308   | 2          | 1996-09-18 |
| 10309   | 37         | 1996-09-19 |
| 10310   | 77         | 1996-09-20 |
+---------+------------+------------+
3 rows in set (0.00 sec)

Comments

Popular posts from this blog

how to Install Numpy, Pandas and matplotlib on ubuntu 18.04 and Linux Mint

Install Python,NumPy,Matplotlib for Python 3 on Ubuntu 18.04, Linux Mint, Debian Linux.
This is a short article about installing Numpy, Pandas , Matplotlib, Python3 on the latest Ubuntu 18.04 LTS, Linux Mint, Debian Linux which comes with Python 3.6.5. Let’s start by making sure we have an updated system: 1 sudo apt update2 sudo apt upgrade
Now, let’s install NumPy,Pandas,Matplotlib :

sudo apt-get install python-pipsudo pip install numpysudo pip install pandassudo pip install matplotlibTest numpy :

Draw a Pie Chart using python Matplotlib

Draw a Pie Chart using python Matplotlib Code : import matplotlib.pyplot as plt

labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [20, 35, 40, 150]
explode = (0, 0.1, 0, 0)
fig1, ax1 = plt.subplots()
ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
        shadow=True, startangle=90)
ax1.axis('equal')

plt.show()
Output :

Java Socket Programming

To implement communication between Client and Server using the UDP protocol and datagrams

TServer
import java.net.*; import java.io.*; import java.util.*; public class TServer { public static void main(String[] args) throws Exception{ DatagramSocket ss = new DatagramSocket(1234); while(true){ System.out.println("Server is up...."); byte[] rd=new byte[100]; byte[] sd=new byte[100]; DatagramPacket rp = new DatagramPacket(rd,rd.length); ss.receive(rp); InetAddress ip= rp.getAddress(); int port=rp.getPort(); Date d=new Date(); // getting system time String time= d + ""; // converting it to String sd=time.getBytes(); // converting that String to byte System.out.println(port); System.out.println(ip); DatagramPacket sp=new DatagramPacket(sd,sd.length,ip,port); ss.send(sp); rp=null; System.out.println("Done !! "); } } }

TClient

import java.net.*; import java.io.*; public class TClient { public static void main(String[] args) throws Exception{ System.out.print…