Sunday, November 1, 2015
How to determine the version and edition of SQL Server and its components
Select @@version
for more info read https://support.microsoft.com/en-us/kb/321185
Saturday, May 16, 2015
Northwind Sample DB Script is not work on SQL 2014
Friday, September 6, 2013
Using ODBC 32-bit on 64-bit Operating System
What wrong? It took me couple hours to figure out. Microsoft Access 2007 may not work with other 64-bit driver or program yet. Installed MySQL ODBC 32-bit solve the problem.
On Windows 8.1, there are two ODBC Administrors under Control Panel – Administrative Tools. One for ODBC Datasources 32-bit and one for ODBC Datasources 64-bit. On Windows Server 2008 R2, there is only one reference to ODBC Administrator. This is 64-bit. Where is 32-bit? To add or manage DSN for ODBC 32-bit, you need to call program odbcad32.exe in C:\Windows\SysWOW64\
Hope this help.
Saturday, August 17, 2013
WAMP
WAMP stands for Microsoft Windows operating system, Apache web server, MySQL database, and PHP general-purpose scripting language for server side Web development. Among WAMP server packages, I like WampServer since it easy to instal, have latest version from Apache, MySQL and PHP and it's free. Before you install the WampServer, you need to make sure your computer have:
- Microsoft Visual C++ 2010 run-time. Without Microsoft Visual C++ 2010 run-time, you will see the error message "vcr100.dll missing" when install.
- Microsoft .NET Framework 3.5.1. This fixed the problem 'aestan tray menu has stopped' when you start the WampServer
To install Microsoft Visual C++ 2010 Redistributable Package (x64) ( http://www.microsoft.com/en-us/download/details.aspx?id=14632 )
On Windows 2008R2 server, make sure .NET Framework 3.5.1 enable. It disable by default. ( http://social.technet.microsoft.com/Forums/windowsserver/en-US/ac1bf719-0a88-4b5d-be98-395f2623e805/what-version-of-net-framework-comes-with-windows-2008-r2 )
Thursday, March 7, 2013
SQL Questions and Answers - Part 3
A view can be thought of as either a virtual table or a stored query. The data accessible through a view is not stored in the database as a distinct object. What is stored in the database is a SELECT statement. The result set of the SELECT statement forms the virtual table returned by the view. ( msdn.microsoft.com )
What is an Index?
A Microsoft® SQL Server™ index is a structure associated with a table or view that speeds retrieval of rows from the table or view. An index contains keys built from one or more columns in the table or view. These keys are stored in a structure that allows SQL Server to find the row or rows associated with the key values quickly and efficiently. ( msdn.microsoft.com )
What are all the different types of indexes?These are different types of indexes in Microsoft SQL Server 2008R2:
- Clustered: A clustered index sorts and stores the data rows of the table or view in order based on the clustered index key. The clustered index is implemented as a B-tree index structure that supports fast retrieval of the rows, based on their clustered index key values.
- Nonclustered: A nonclustered index can be defined on a table or view with a clustered index or on a heap. Each index row in the nonclustered index contains the nonclustered key value and a row locator. This locator points to the data row in the clustered index or heap having the key value. The rows in the index are stored in the order of the index key values, but the data rows are not guaranteed to be in any particular order unless a clustered index is created on the table.
- Unique: A unique index ensures that the index key contains no duplicate values and therefore every row in the table or view is in some way unique. Both clustered and nonclustered indexes can be unique.
- Index with included columns: A nonclustered index that is extended to include nonkey columns in addition to the key columns.
- Full-text: A special type of token-based functional index that is built and maintained by the Microsoft Full-Text Engine for SQL Server. It provides efficient support for sophisticated word searches in character string data.
- Spatial: A spatial index provides the ability to perform certain operations more efficiently on spatial objects (spatial data) in a column of the geometry data type. The spatial index reduces the number of objects on which relatively costly spatial operations need to be applied.
- Filtered: An optimized nonclustered index, especially suited to cover queries that select from a well-defined subset of data. It uses a filter predicate to index a portion of rows in the table. A well-designed filtered index can improve query performance, reduce index maintenance costs, and reduce index storage costs compared with full-table indexes.
- XML: A shredded, and persisted, representation of the XML binary large objects (BLOBs) in the xml data type column.
Related posts:
SQL Questions and Answers – Part 3
SQL Questions and Answers – Part 2
SQL Questions and Answers – Part 1
Sunday, February 24, 2013
MySQL error #1045 on GoDaddy phpMyAdmin
#1045 – Access denied for user ‘myusername’@’10.10.10.10’ (using password: YES)
What???
After couple attempts for a few hours, I decided to use a new difference password. Now it worked. It seem to me, there is a character in my initial password did not carry to or accepted by MySQL database.
Thursday, February 7, 2013
SQL Questions and Answers - Part 2
What is a constraint?
Constraints let you define the way the Database Engine automatically enforces the integrity of a database. Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. SQL Server supports the following classes of constraints:
NOT NULL specifies that the column does not accept NULL values.
CHECK constraints enforce domain integrity by limiting the values that can be put in a column.
UNIQUE constraints enforce the uniqueness of the values in a set of columns.
PRIMARY KEY constraints identify the column or set of columns that have values that uniquely identify a row in a table.
FOREIGN KEY constraints identify and enforce the relationships between tables.
Read more at http://msdn.microsoft.com/
What is a unique constraint?
A Unique constraint uniquely identified each record in a table. This provides uniqueness for the column or set of columns. Use a Unique constraint when you want to enforce the uniqueness of a column, or combination of columns, that is not the primary key. Unique constraint creates a non-clustered index on the column. Unique Key allows only one NULL Value.
What is a Foreign Key (FK)?
A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables. You can create a foreign key by defining a FOREIGN KEY constraint when you create or modify a table.
Read more at http://msdn.microsoft.com/
What is the difference between Primary Key (PK) and Unique Key (UK)?
A Primary Key (PK) can not have a Null value. A Unique Key can have one Null value.
Primary Key creates a clustered index on the column. Unique Key creates a non-clustered index on the column.
Each table may have only one PK but many unique constraints.
What is a join?
An SQL join clause combines records from two or more tables in a database. A JOIN is a means for combining fields from two tables by using values common to each. ANSI standard SQL specifies four types of JOIN: INNER, OUTER, LEFT, and RIGHT. As a special case, a table (base table, view, or joined table) can JOIN to itself in a self-join.
What are the types of join?
Inner Join: Inner join returns only the rows that have a match in both joined tables.
Right Outer Join: Right join returns all the rows from the right hand side table even though there are no matches in the left hand side table.
Left Outer Join: Left join returns all the rows from left hand side table even though there are no matches in the right hand side table.
Full Outer Join: Full join returns all rows in all joined tables are included, whether they are matched or not. Cross Join: Cross join return all rows from the left table. Each row from the left table is combined with all rows from the right table. Cross joins are also called Cartesian products.
Read more at http://msdn.microsoft.com/
Related posts:
SQL Questions and Answers – Part 3
SQL Questions and Answers – Part 2
SQL Questions and Answers – Part 1
Saturday, January 26, 2013
SQL Questions and Answers
SQL stands for Structured Query Language. It is a special-purpose programming language designed for managing data in relational database management systems (RDBMS). Most popular SQL commands are "Select", "Insert", "Update", and "Delete".
What is RDBMS?
RDBMS stands for Relational Database Management System. It is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd, of IBM's San Jose Research Laboratory. Many popular databases such as IBM DB2, MySQL, Microsoft SQL, Oracle currently in use are based on the relational database model.
What is database normalization?
Database normalization is the process of organizing the fields and tables of a relational database to minimize redundancy and dependency. Normalization usually involves dividing large tables into smaller (and less redundant) tables and defining relationships between them. (http://en.wikipedia.org/wiki/Database_normalization)
What is a primary key?
A primary key is a single field or combination of fields that uniquely defines a record. Primary key can not contain a null value. A table can have only one primary key.
What is a stored procedure?
A stored procedure is a group of Transact-SQL statements compiled into a single execution plan.
What is a trigger?
A database trigger is a special stored procedure that is automatically executed in response to certain events on a particular table or view in a database. The trigger is mostly used for maintaining the integrity of the information on the database.
Related posts:
SQL Questions and Answers – Part 3
SQL Questions and Answers – Part 2
SQL Questions and Answers – Part 1