With just a dozen commands and functions, a developer is able to perform most activities related to querying and manipulating a database. Commands like Select , insert , delete , update , create Function like Sum () Avg () Max() , Min() Count() The SQL declarations, or commands, are divided into two main categories: DDL and DML DDL, or data definition language, is the part of SQL used to define the data and objects in a database. When these commands are used, entries are made in a data dictionary in the SQL server. Following are some DDL commands: Create Table-, Create Index , Alter Table, Drop Table, Drop Index DML, the language for manipulating data, is the part of SQL used to recover or manipulate data. Its commands are responsible for the queries and changes made to tables. These are some of the most important commands in this category: Select , insert , update rollback Data Type in SQL Char Character data type with fixed size of up to 254 characters. Date Stores only the date. Datetime or Timestamp When part of the input argument is omitted, SQLBase assumes the default 0, which converts the date to 30/12/1899 and 12:00 a.m. Decimal or Dec Supports up to 15 digits (999999999999999 to +999999999999999). If nothing is specified, the precision 5 and scale 0 are assumed. Double precision Numeric data type of floating-point and double precision. Float When the precision is between 1 and 21, the data type will have simple precision. Between 22 and 53, the precision is double. Integer or Int An integer data type with precision of up to 10 digits (2,147,483,648 up to + 2,147,483,647). Long Varchar Stores characters or binary objects. This is equivalent to the data type blob. Number This is a super set from other data types. It supports precision of up to 22 digits. Real Numeric data type of floating-point and simple precision. Smallint This data type has no fractional digits. The digits to the right of the decimal point are truncated. You can have precision of up to five digits (from 32,768 to +32,767). Time Stores only the hour. Varchar Character data type with fixed size of up to 254 characters. Select command is the essence of the SQL language Basic syntax: SELECT [*] [ALL | DISTINCT] [name =] expression [expression [AS name]] FROM [correlation_name] WHERE [GROUP BY ] ] [HAVING ] [ORDER BY [ASC] [DESC]] ] Selects all the columns in a table. ALL The default in a SELECT command is to recover all the rows. DISTINCT Does not show duplicated rows. expression A selection list of expressions separated by commas. An expression can be a column name, a constant, a checked variable, the result of a function, or a system keyword. FROM Contains the names of the tables or views resulting in a set of rows. correlation_name A related name can be used to designate a preceding table or view. WHERE Specifies a search condition for the basic tables or views. The search condition cannot contain aggregate functions. GROUP BY This clause groups the resulting rows of a query, according to the column names. When the column by which the grouping occurs is an expression with more than one column, you must specify the number that indicates its relative position in the selection list. HAVING This clause allows you to establish a search condition with a group of rows resulting from a GROUP BY clause or by grouped columns. ORDER BY Specifies the order of rows in a result table. The rows can be ordered by more than one column. When the order column is derived from a function or arithmetic expression, the column must be specified by an integer that indicates the relative number of its position in the SELECT command. Optionally, ASC or DESC, indicating the ascending or descending order, can follow each column name or number. Instead of showing all the columns, you can request a list of specific columns This list must contain the names of the columns separated by commas. The order of the columns is not important. The code below selects the columns containing the first name, last name, and telephone number of each author. SELECT au_fname, au_lname, phone FROM authors; Share and Care |
For Latest Updates Always Visit http://satish24k.blogspot.com/ |
For Further Reading,
0 comments:
Post a Comment