A Guide to SQL Questions
1. How do you create a table using SQL?
2. How do you delete a table using SQL?
3. What are the common data types used to define columns using SQL?
4. Identify the best data type to use to store the following data in Oracle, in SQL Server, and in Access:
a. The month, day, and year that an employee was hired
b. An employee’s Social Security number
c. The department in which an employee worksd. An employee’s hourly pay rate
5. Identify the following column names as valid or invalid in Oracle:
a. COMMISSIONRATE
b. POSTAL_CODE_5CHAR
c. SHIP TO ADDRESS
d. INVOICE-NUMBER
6. What is a null value? How do you use SQL to identify columns that cannot accept null values?
7. Which SQL command do you use to add a row to a table?
8. Which SQL command do you use to view the data in a table?
9. Which SQL command do you use to change the value in a column in a table?
10. Which SQL command do you use to delete rows from a table?
11. How do you display the columns in a table and their characteristics in Oracle?
12. Explain the difference between the CHAR data type and the VARCHAR data type. Use the Internet to find examples of when to use VARCHAR and when to use CHAR. Be sure to cite the URL(s) that provided the examples as references at the end of your document.
13. Use the Internet to research BOOLEAN data types. What is a BOOLEAN data type and what is it called in Oracle, SQL Server, and Access? Be sure to cite the URL(s) that provided the information at the end of your document.
1) CREATE TABLE <table_name> ( *<Column_name> <Data_Type>);
2) DROP TABLE <table_name>;
3) int, varchar, varchar2, date, time, datetime, etc
4) (a) datetime (b) int (c) varchar2
5) (c) and (d) are invalid
6) A null value is a value which is defined when a variable does not contain any value. The SQL statement is
SELECT <column_names>
FROM <table_name>
WHERE <column_name> IS NOT NULL;
7) INSERT INTO table(column1,...) VALUES(value1, ....);
8) SELECT column1, column2, ...FROM table_name;
9) UPDATE table_name SET column1 = value1 WHERE condition;
10) DELETE Product WHERE column_name=value
11) SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('dbo.table_name')
12) varchar is variable length whereas char is fixed length.
13) ORACLE - CHAR(1) is used to store Y or N ; SQL SERVER - BIT is used; ACCESS - BIT is used
Get Answers For Free
Most questions answered within 1 hours.