into to sql1 Flashcards

(24 cards)

1
Q
  1. Creates a new table in the user’s database schema
  2. Ensures that a column will** not have null** values
  3. Ensures that a column will not have duplicate values
  4. Defines a default value for a column (when no value is given)
  5. Validates data in an attribute
A
  1. CREATE TABLE
  2. NOT NULL
  3. UNIQUE
  4. DEFAULT
  5. CHECK
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. Creates an index for a table
  2. Creates a dynamic subset of rows and columns from one or more tables
  3. Modifies a table’s definition (adds, modifies, or deletes attributes or
    constraints)
  4. Creates a new table based on a query in the user’s database schema
  5. Permanently deletes a table (and its data)
  6. Permanently deletes an index
  7. Permanently deletes a view
A
  1. CREATES INDEX
  2. CREATES VIEW
  3. ALTER TABLE
  4. CREATE TABLE AS
  5. DROP TABLE
  6. DROP INDEX
  7. DROP VIEW
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. Inserts row(s) into a table
    2.** Selects attributes f**rom rows in one or more tables or views
    **3. Restricts the selection of rows based on a conditional expression
    **4. Groups the selected rows based on one or more attributes
  2. Restricts the selection of grouped rows based on a condition
  3. **Orders the selected rows **based on one or more attributes
  4. ** Modifies an attribute’s values **in one or more table’s rows
  5. Deletes one or more rows from a table
A

1.INSERT
2. SELECT
3. WHERE
4. GROUP BY
5. HAVING
6. ORDERED BY
7. UPDATE
8. DELETE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. **
    any value within a value list**1. Checks whether an attribute value is within a range
  2. Checks whether an attribute value** is null**
  3. Checks whether an attribute value matches a given string pattern
  4. Checks whether an attribute value matches**
    any value within a value list**
  5. Checks whether a subquery returns any rows
  6. Limits values to unique values
A
  1. BETWEEN
  2. IS NULL
  3. LIKE
  4. IN
  5. EXIST
  6. DISTINCT
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. Returns the number of rows with non-null values for a given column
  2. Returns the minimum attribute value found in each column
  3. Returns the maximum attribute value found in each column
  4. eturns the sum of all values for a given column
  5. Returns the average of all values for a given column
A
  1. COUNT
  2. MIN
  3. MAX
  4. SUM
  5. AVG
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. *To show the current database
  2. *To create the database with the database name
  3. *To delete a record
  4. To change the data type of a columb in table
A
  1. SHOW DATABASES;
  2. CREATE DATABASE[ ];
  3. DELTE FROM tablename [WHERE Contidition ];
  4. ALTER TABLE (tname) MODIFY COLUMN Cname TYPE;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. This is a standard interactive progg lang for getting info from n updating to database

T/F
1. SQL are** not case SEnsitive**
2. SQL can be 1 or more lines
3. SQL ended w “;’
4. Keywords **cannot be abbreviated or split **
5. Clauses r usually placed on seperate lines

A
  1. SQL / Structured Query Language
  2. 1-6 is True
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. asequence of info echange n related work, for the purposes of satisfying a request and for ensuring database integrity
  2. from 1 has 2 types, statemnet tosaves n end current transaction n make permanaent changes
  3. statement to undo work done in current transaction
A
  1. Transaction
    ~
  2. COMMIT
  3. ROLLBACK

Start transaction;
Update Employees;
Set Salary =Salary + 80
Where Dept = ‘Salary’;
Commit;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

1.t he most popular PHP development environment, meaning?
2. If there is** any violation between the constraint and
the data action, the action is aborted by the __?

A

XAMpP/ Cross-Platform Apache, Mysql, Perl
2. Constraint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. what Logical Operators 3?
  2. whats T X T = T only no to T x F
  3. only t if there is t (t x f= true, t x t = tru)
  4. Tru or Fals (**% **means any and all following or
    preceding characters are eligible.
    ▪ For example,
    ▫ ‘J%’ includes Johnson, Jones,
    Jernigan, July, and J-231Q.
    ▫ ‘Jo%’ includes Johnson and
    Jones
A
  1. AND, OR, NOT
  2. AND
  3. OR
  4. TRUE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. means any one character may be substitute
    2.?? functions will then summarize the data within each smaller collection.
    3.an alternative NAME given to acolumn or table in any sql statement, this gives temporary name
A
  1. _ ex (‘_23-56-678’ includes 123-156-6781, 123-256-
    6782, and 823-956-6788.
    ▫ ‘_o_es’ includes Jones, Cones, Cokes, totes,
    and roles. 13)
  2. Aggregate functions
  3. ALIAS (Select tname AS aliastabletname)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. we combine four columns (CustomerName,Address, City,
    PostalCode, and Country
    ) and create an alias named “Address” table is Customer, u may use CONCAT
A
  1. SELECT CustomerName, CONCAT ( Address+’, ‘+city+’,’+PostalCode+’, ‘+Country’ AS Address
    from Cutomer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  1. R used to combine rows from 2 or more tables
  2. This clause used to combine 2 or more table, based on a COMMON field between them
  3. whats most comon type of joim
A
  1. SQL
  2. SQL Join
  3. INNER Join
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. this return qll rows when theres AT LEAST ONE MATCH IN BOTH TABLES
  2. This retuen all rows from the left table n matched rows from the right table
  3. this returns all the rows from the rightable, n matched rows from the left table
  4. This return all rows when there is a MATCH in one of the tables, combines results of both LEFT n Right
A
  1. INner Join
  2. Left Join aka left outer Join
  3. Right Join/ right outer Join
  4. full Join / full outer join
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  1. used to combine the result set of 2 or more SELECT statements, what command to select duplicate values
    1. ? a quary within another sql Query, this is used to return data that will be used in the main query as condition to restrict data to be retrieves
      3.
A
  1. union & union all
  2. subquery,
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  1. Subquery can be used w ? 7 and 3 Clauses
A
  1. select
  2. update,
  3. Insert
  4. Delete
  5. In
  6. Between
  7. SELECT
  8. FROM
  9. WHERE
17
Q
  1. A subquery is also called an ?? or ?? while the statement containing a subquery is also called an outer query or outer select
  2. ?? executes first it sparent query so the results ??? can be passed to the outer query
A
  1. inner query or inner select
  2. inner query
    SELECTa.studentid,a.name,b.total_marks
    FROMstudenta,marksb
    WHEREa.studentid=b.studentidANDb.total_marks>
    (SELECTtotal_marks FROMmarks WHEREstudentid=’V002’);
18
Q

T/F
1. subquery must be open parenthesis
2. subquery must be placed on the right side of the cOMPARISON operator
3. subqueries cannot mannipulate their results internally, kaya ORDER BY clause cannot be added SA SUBQUERY, but u can use it sa Outer query
4. Use single-row operators with single-row subqueries.
5. If a subquery (inner query) returns a null value to the outer query, the outer query will not return any rows when using certain comparison operators in a WHERE clause.

A
  1. F
  2. T rue lahat
19
Q
  1. Use the IN clause to copy** the table into another database:
    SELECT **
    *INTO CustomersBackup2013 IN ‘Backup.mdb’FROM Customers;

Copy only a few columns into the new table:
SELECT** CustomerName, ContactNameI**NTO CustomersBackup2013FROM Customers;

20
Q

1.is a virtual relation based on the result-set of a Select Statement.
2.3 kinds of relation

A
  1. VIEW
  2. 1- Stored relation/ base relation = tables,
    2- Virtual relations= views
    3-Temporary results
21
Q
  1. . Write a query to find the name (first_name, last_name) of all employees who works in the IT department.
  2. Write a query to find the name (first_name, last_name) of the employees who are managers.
A
  1. SELECT first_name, last_name
    FROM employees
    WHERE department_id
    IN (SELECT department_id FROM departments WHERE department_name=’IT’);
    2.
    SELECT first_name, last_name
    FROM employees
    WHERE (employee_id IN
    – Subquery to select manager_ids from the employees table
    (SELECT manager_id FROM employees)
    );
22
Q
  1. defines the access rights provided to a user on a database objec
  2. this allows user to CREATE, ALTER, DROP DATAbase
  3. allos the user to EXECUTE, SELECT, INSERT , UPDATE, DELETE from database
A

`. PRIVILEDGES

  1. System Priveledges
  2. Object priveledges
23
Q

this commands r used to enforce database security in a mmultiple user dataabase environment

  1. this command use to PROVIDE ACCESS/ priviledges on the database OBJECT to users
  2. command removes USERS ACCESS RIGHTS to the b=database objects
A
  1. DCL (Data Cont.rolling Language)
  2. GRANT
  3. REVOKE