Chapter 9 SQL Statements
555
Character strings inserted into tables are always stored in the same case as
they are entered, regardless of whether the database is case sensitive or not.
Thus a string Value inserted into a table is always held in the database with
an upper-case V and the remainder of the letters lower case. SELECT
statements return the string as Value. If the database is not case-sensitive,
however, all comparisons make Value the same as value, VALUE, and so
on. Further, if a single-column primary key already contains an entry Value,
an INSERT of value is rejected, as it would make the primary key not
unique.
Performance tip
To insert many rows into a table, it is more efficient to declare a cursor
and insert the rows through the cursor, where possible, than to carry out
many separate INSERT statements.
♦ SQL/92 Entry level feature.
♦
Sybase Supported by Adaptive Server Enterprise.
♦ Add an Eastern Sales department to the database.
INSERT
INTO department ( dept_id, dept_name )
VALUES ( 230, ’Eastern Sales’ )
♦ Fill the table dept_head with the names of department heads and their
departments.
INSERT
INTO dept_head (name, dept)
SELECT emp_fname || ’ ’ || emp_lname
AS name,
dept_name
FROM employee JOIN department
ON emp_id = dept_head_id
Standards and
compatibility
Examples