ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafyvalues.htm

63 lines
4.1 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Insert rows using the VALUES keyword" />
<meta name="abstract" content="You can use the VALUES keyword to insert a single row or multiple rows into a table." />
<meta name="description" content="You can use the VALUES keyword to insert a single row or multiple rows into a table." />
<meta name="DC.subject" content="INSERT statement, inserting rows, using VALUES, row, inserting using VALUES, into a table, table, inserting rows into, using VALUES, examples, inserting rows" />
<meta name="keywords" content="INSERT statement, inserting rows, using VALUES, row, inserting using VALUES, into a table, table, inserting rows into, using VALUES, examples, inserting rows" />
<meta name="DC.Relation" scheme="URI" content="rbafyinsert.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbafyvalues" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Insert rows using the VALUES keyword</title>
</head>
<body id="rbafyvalues"><a name="rbafyvalues"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Insert rows using the VALUES keyword</h1>
<div><p>You can use the VALUES keyword to insert a single row or multiple
rows into a table. </p>
<div class="section"><p>An example of this is to insert a new row into the DEPARTMENT
table. The columns for the new row are as follows:</p>
<ul><li>Department number (DEPTNO) is 'E31'</li>
<li>Department name (DEPTNAME) is 'ARCHITECTURE'</li>
<li>Manager number (MGRNO) is '00390'</li>
<li>Reports to (ADMRDEPT) department 'E01'</li>
</ul>
<p>The INSERT statement for this new row is as follows:</p>
<pre><strong>INSERT INTO</strong> DEPARTMENT (DEPTNO, DEPTNAME, MGRNO, ADMRDEPT)
<strong>VALUES</strong>('E31', 'ARCHITECTURE', '00390', 'E01')</pre>
<p>You
can also insert multiple rows into a table using the VALUES clause. The following
example inserts two rows into the PROJECT table. Values for the Project number
(PROJNO) , Project name (PROJNAME), Department number (DEPTNO), and Responsible
employee (RESPEMP) are given in the values list. The value for the Project
start date (PRSTDATE) uses the current date. The rest of the columns in the
table that are not listed in the column list are assigned their default value.</p>
<pre><strong>INSERT INTO</strong> PROJECT (PROJNO, PROJNAME, DEPTNO, RESPEMP, PRSTDATE)
<strong>VALUES</strong>('HG0023', 'NEW NETWORK', 'E11', '200280', <strong>CURRENT DATE</strong>),
('HG0024', 'NETWORK PGM', ''E11", '200310', <strong>CURRENT DATE</strong>)</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyinsert.htm" title="This topic shows the basic SQL statements and clauses that insert data into tables and views. Examples using these SQL statements are supplied to help you develop SQL applications.">Insert rows using the INSERT statement</a></div>
</div>
</div>
</body>
</html>