20.07.2013 Views

Beginning SQL

Beginning SQL

Beginning SQL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure B-86<br />

You enter <strong>SQL</strong> queries in the command line. Type the following statement:<br />

CREATE TABLE MyTable (MyColumn int);<br />

Press Enter to execute the <strong>SQL</strong> and create MyTable. You should receive a confirmation message from the<br />

console. After creating MyTable, you need to insert some data. Type the following statement and press<br />

Enter:<br />

INSERT INTO MyTable(MyColumn) VALUES(123);<br />

Enter and execute the following line of <strong>SQL</strong> code:<br />

INSERT INTO MyTable(MyColumn) VALUES(888);<br />

In order to see what data is contained in MyTable, clear the <strong>SQL</strong> entry box and type the following statement:<br />

SELECT * FROM MyTable;<br />

Press Enter and you should see a screen similar to what appears in Figure B-87:<br />

It’s vital to note that none of the data is permanently stored in the database unless you tell Oracle to<br />

store the data by issuing a COMMIT command. If you don’t issue a COMMIT command, the data you<br />

entered is deleted when you close the <strong>SQL</strong>*Plus tool. Type the COMMIT command as shown below in the<br />

command line:<br />

COMMIT;<br />

Setting Up and Using the Five Database Systems<br />

449

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!