If a table contains duplicate rows, does a query result display the duplicate values by default? How can you eliminate duplicate rows from a query result?

A query result displays all rows including the duplicate rows. To eliminate duplicate rows in the result, the DISTINCT keyword is used in the SELECT clause.

Is a NULL value same as zero or a blank space? If not then what is the difference?

  1. Null is an absence of a value. An empty string is a value, but is just empty. Null is special to a database.
  2. Null has no bounds, it can be used for string, integer, date, etc. fields in a database.
  3. NULL isn’t allocated any memory, the string with NUll value is just a pointer which is pointing to nowhere in memory. however, Empty IS allocated to a memory location, although the value stored in the memory is "".

What is data integrity in database

data integrity” refers to the accuracy and consistency of data stored in a database, data warehouse, data mart or other construct. The term –Data Integrity – can be used to describe a state, a process or a function – and is often used as a proxy for “data quality”.

What is a constraint?

SQL constraints are used to specify rules for the data in a table.

If there is any violation between the constraint and the data action, the action is aborted by the constraint.

Constraints can be specified when the table is created (inside the CREATE TABLE statement) or after the table is created (inside the ALTER TABLE statement).

What is sub query? And what are the types of sub query?

A subquery is a SELECT statement within another statement.

  • A subquery may occur in :
    • – A SELECT clause
    • – A FROM clause
    • – A WHERE clause
  • The subquery can be nested inside a SELECT, INSERT, UPDATE, or DELETE statement or inside another subquery.
  • A subquery is usually added within the WHERE Clause of another SQL SELECT statement.
  • You can use the comparison operators, such as >, <, or =. The comparison operator can also be a multiple-row operator, such as IN, ANY, or ALL.
  • A subquery is also called an inner query or inner select, while the statement containing a subquery is also called an outer query or outer select.
  • The inner query executes first before its parent query so that the results of an inner query can be passed to the outer query.

Types of Subquery

  • Single row subquery : Returns zero or one row.
  • Multiple row subquery : Returns one or more rows.
  • Multiple column subqueries : Returns one or more columns.
  • Correlated subqueries : Reference one or more columns in the outer SQL statement. The subquery is known as a correlated subquery because the subquery is related to the outer SQL statement.
  • Nested subqueries : Subqueries are placed within another subquery.

What is a query?

A query is an inquiry into the database using the SELECT statement. A query is used to extract data from the database in a readable format according to the user’s request.

What is collation?

Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width

What are aggregate and scalar functions?

The Scalar Numeric Function operates on numeric values (i.e. INTEGER, SMALLINT, DECIMAL, FLOAT, DOUBLE and NUMERIC data types). The PointBase database supports the following standard Numeric Functions:

  • Multiplication
  • Division
  • Addition
  • Subtraction

The numeric functions are evaluated in the following order. Numeric Functions within parentheses are evaluated from the innermost set of parentheses, following the same rules of precedence:

    1. Multiplication (*) and division (/) from left to right
    2. Addition (+) and subtraction (-) from left to right

Numeric Functions are calculated as floating point numbers with a precision of 17 significant digits (and a rounding error). However, if you use these functions when inserting or updating data the accuracy is dependent up on the data type of the column for which the data is intended.

What is user defined functions?

userdefined functions are routines that accept parameters, perform an action, such as a complex calculation, and return the result of that action as a value. The return value can either be a single scalar value or a result set.

Blog at WordPress.com.

Up ↑