=database name = orderandinvoise
tables == cart (cartId PK ASC, productId, UserId, CartstatusId)
for a cart we have = CartStatus( CartStatusId PK ASC,CartStatus)
category(catId PK ASC, CatName,IsActive,Isdelete)
Product(prodId,CatId,.....)
Roles(RoleIS PK, ROleName Unique);
ShippingDetails(shippingDetailId PK, UserID....adress,state, zipcode,orderId)
UserRoles(userROleId PK,UserId,RoleId,RoleName)
Users(UserId PK, names unique,email,password,RoleId)
relationship between tables
Users = constraint df_roleId default is 1
cart with ProductId
Product with CategoryID
ShippingDetails with UserId
database name = online shop
table = adminuser(id pk asc, username, password)
table = customer(custId, name, address, orderdate,Id)
table = orders(orderID, price, amount,quantity).
created a procedure GetBySearch to get the products and Categories based on the
left join with product and category
and to create report we have used category name product name, product desc, prod
Price
logical questions
containment = none if not specified then the first file in the databse becomes the
primary file.
LOG ON Specifies that the disk files used to store the database log, log files, are
explicitly defined.
compatiblity level means Is the version of SQL Server with which the database is
to be made compatible
FULLTEXTSERVICEPROPERTY = returns 1 if full text is installed
Supported for backward compatibility only for ].[sp_fulltext_database] @action =
'enable not needed above sql server 2008.
and then we have various rules
ANSI_NULL_DEFAUL
Determines the default value, NULL or NOT NULL, of a column or CLR user-defined
type for which the nullability isn't explicitly defined in CREATE TABLE or ALTER
TABLE statements
ARITHABORT { ON | OFF } mathematical error suspension
for alter rules
Clear procedure cache.
Set the MAXDOP parameter to an arbitrary value (1,2, ...) for the primary database
based on what works best for that particular database and set a different value
(such as 0) for all secondary database used (such as for reporting queries)
SET QUOTED_IDENTIFIER must be ON when you are creating a filtered index.
SET QUOTED_IDENTIFIER must be ON when you invoke XML data type methods
PAD_INDEX = { ON | OFF } When ON, the percentage of free space specified by
FILLFACTOR is applied to the intermediate level pages of the index. When OFF or a
FILLFACTOR value it not specified, the intermediate level pages are filled to near
capacity leaving enough space for at least one row of the maximum size the index
can have, considering the set of keys on the intermediate pages. The default is
OFF.
STATISTICS_NORECOMPUTE = { ON | OFF } When ON, out-of-date index statistics are not
automatically recomputed. When OFF, automatic statistics updating are enabled. The
default is OFF.
IGNORE_DUP_KEY = { ON | OFF } Specifies the error response when an insert operation
attempts to insert duplicate key values into a unique index. The IGNORE_DUP_KEY
option applies only to insert operations after the index is created or rebuilt. The
option has no effect when executing CREATE INDEX, ALTER INDEX, or UPDATE. The
default is OFF.
ALLOW_ROW_LOCKS = { ON | OFF } When ON, row locks are allowed when you access the
index. The Database Engine determines when row locks are used. When OFF, row locks
are not used. The default is ON.
ALLOW_PAGE_LOCKS = { ON | OFF } When ON, page locks are allowed when you access the
index. The Database Engine determines when page locks are used. When OFF, page
locks are not used. The default is ON
Unique cluster We can improve query performance using the covering index
Procedures
Accept input parameters and return multiple values in the form of output parameters
to the calling procedure or batch.
Contain programming statements that perform operations in the database, including
calling other procedures.
Return a status value to a calling procedure or batch to indicate success or
failure (and the reason for failure)