Insert Into Customer1 (ID, CustomerName, City, Country) Values(103, 'Marwa','Baghdad','Iraq')
|
|
- Antonia Bryant
- 5 years ago
- Views:
Transcription
1 Insert Into Customer1 (ID, CustomerName, City, Country) Values(103, 'Marwa','Baghdad','Iraq')
2 Notes: 1. To View the list of all databases use the following command: Select * (or name) From Sys.databases
3 2. to view all tables in the current database we use: Select * From INFORMATION_SCHEMA.TABLES
4 Update Query The SQL UPDATE Query is used to modify the existing records in a table. You can use WHERE clause with UPDATE query to update selected rows otherwise all the rows would be affected. The basic syntax of UPDATE query with WHERE clause is as follows: Update tablename Set columnname1=value1, columnname2=value2,..., columnnamen=valuen Where (Condition) You can combine N number of conditions using AND or OR operators.
5 Example: From the table Customer1 set the address value of (Marwa) as (Street-62).
6 Update Customer1 set [Address] = 'Street-62' Where ID=103 Now, Customer Hammed changes his postal code from to Write a query to update the customers information?
7 Update Customer1 set postalcode = ' ' Where ID=100
8 Notes: If we execute the query of update without using Where clause, all the records of this table will update that field with the new values. For example if we use the following query: Update Customer1 set postalcode = ' ' All the postal code of the customers table will change into ( )
9 Delete Query The SQL DELETE Query is used to delete the existing record(s) from a table. You can use WHERE clause with DELETE query to delete selected rows, otherwise all the records would be deleted. The basic syntax of DELETE query with WHERE clause is as follows: Delete From table_name Where (condition) Be careful when we use Delete without Where clues.
10 Example: Tom is transferred to another department and this record must be deleted from the table, we use the following query
11 Delete From Customer1 Where ID=101
12 SQL - TRUNCATE TABLE COMMAND The SQL TRUNCATE TABLE command is used to delete complete data from an existing table. You can also use DROP TABLE command to delete complete table but it would remove complete table structure form the database and you would need to re-create this table once again if you wish you store some data. Syntax: Truncate Table table_name
13 SQL Server Lecture 9 Store Procedure Store Procedure With Input Parameter(s) Store Procedure With Output Parameter(s)
14 Store Procedure
15 A stored procedure is group of T-SQL (Transact SQL) statements. If you have a situation, where you write the same query over and over again, you can save that specific query as a stored procedure and call it just by it's name.
16 Create Store Procedure Let we have the following table: And we use the following command for the several time Select Name, Gender From Employee3
17 At this case for the batter using procedure. The general form of create procedure is: Create Procedure procedure_name as Begin statement(s) End OR Create Proc procedure_name as Begin statement(s) End
18 To create a procedure of the following statements: Select Name, Gender From Employee3 Create Proc spgetemployees as Begin Select Name, Gender From Employee3 End
19 How to execute procedure? 1. By text procedure name in SQL query: spgetemployees 2. By use the command EXEC or EXECUTE and then procedure name: EXEC spgetemployees OR EXECUTE spgetemployees 3. By use graphical mode
20
21 Store Procedure With Input Parameter(s)
22 This procedure is used when we have a parameter or parameters to input, for example at the pervious table we must inter the Gender and departmentid. For the other hand let say, we need to create a procedure that accepts Gender and DepartmentId. This SP, accepts GENDER and DEPARTMENTID parameters. Parameters and variables have prefix in their name.
23 Create Proc int as Begin Select Name, Gender, DepartmentId From Employee3 Where Gender And DepartmentId End Now, to execute this procedure: spgetemployeesbygenderanddepartmentid 'Male',1
24 On the other hand, if you change the order, you will get an error stating "Error converting data type varchar to int." This is because, the value of "Male" is passed parameter. is an integer, we get the type conversion error. When you specify the names of the parameters when executing the stored procedure the order doesn't matter.
25 Note: All the methods of execute the store procedure without parameter(s) is available with parameters. When we execute the procedure with parameter(s), we must inter the value(s) of this parameters otherwise we get an error. Also in graphical method, we see the following windows that contains the parameter(s) that must enter the value(s) of it
26 Alter Procedure At the pervious example (spgetemployees) which procedure is: Create Proc spgetemployees as Begin Select Name, Gender, DepartmentId From Employee3 End After creation of this procedure, we need to sort the name, therefore at this case we must ALTER procedure as the following:
27 Alter Proc spgetemployees as Begin Select Name, Gender From Employee3 Order By Name End When we execute this procedure, we get: spgetemployees
28 How to view the text of the Store Procedure? To view the text, of the stored procedure Use system stored procedure sp_helptext 'SPName' sp_helptext spgetemployeesbygenderanddepartmentid
29 How to view the text of the Store Procedure? To view the text, of the stored procedure Use system stored procedure sp_helptext 'SPName sp_helptext spgetemployeesbygenderanddepartmentid Right Click the SP in Object explorer -> Scrip Procedure as -> Create To -> New Query Editor Window
30 Encrypt the text of the Store Procedure To encrypt the text of the SP, use WITH ENCRYPTION option. Once, encrypted, you cannot view the text of the procedure, using sp_helptext system stored procedure. There are ways to obtain the original text, which we will talk about in a later session. Alter Proc spgetemployees With Encryption as Begin Select Name, Gender From Employee3 Order By Name End
31 When we use the sp_helptext as the following: sp_helptext spgetemployees We get the message The text for object 'spgetemployees' is encrypted. Also when we use (Right Click the SP in Object explorer -> Scrip Procedure as -> Create To -> New Query Editor Window) we get:
32 Store Procedure With Output Parameter(s)
33 Stored procedures with output parameters To create an SP with output parameter, we use the keywords OUT or is an OUTPUT parameter. Notice, it is specified with OUTPUT keyword.
34 Let we first create the following table(students): Create table Students ( Id int primary key identity(1,1), Name nvarchar(30) not null, Gender nvarchar(10), DepartmentId int )
35 Now, we need to crate the procedure that print a count of specify gender that entered by the user. The general form of creation a procedure with the output parameners is: Create Procedure datatype OUTPUT,... as Begin End
36 Therefore, to create a procedure that specify an gender type (input) and out the count of this type(output), we use: Create Procedure int Output as Begin From Students Where Gender End
37 Execute Store Procedure With Output Parameters After procedure creation, we must execute this procedure to view the result. To execute a store procedure with the output parameters: 1. First initialize a variable of the same datatype as that of the output parameter. We have integer variable. 2. Then pass variable to the SP. You have to specify the OUTPUT keyword. If you don't specify the OUTPUT keyword, the variable will be NULL. 3. Execute
38 int Execute spgetstudentscountbygender Output The results of this procedure is: But if we execute the above procedure as the following: int Execute spgetstudentscountbygender Output The procedure is execute but without any value.
39 Notice that if not declare the output, or not use it in execute the error message will appear: int Execute spgetstudentscountbygender 'Male' Msg 201, Level 16, State 4, Procedure spgetstudentscountbygender, Line 0 Procedure or function 'spgetstudentscountbygender' expects parameter '@StudentsCount', which was not supplied. Also, notice that if not as Output the result is a NULL int Execute spgetstudentscountbygender
40 IF Statement in Store Procedure The general form of using if statement is: If (Condition) Statement else Statemet Now, from pervious example, let we need to if received a value or not by specify the OUTPUT key word or not.
41 At first let we execute the following: int Execute spgetstudentscountbygender Out If is null) Print is NULL' Else Print is not NULL' The results is:
42 But when we execute the following: int Execute spgetstudentscountbygender If is null) Print is NULL' Else Print is not NULL' The results is:
43 Note: If we in execute procedure what different should be made? int Exec spgetstudentscountbygender The output is:
44 Note; When we need information about one of the procedure that we creation we used (sp_help procedure_name), for example: sp_help spgetstudentscountbygender
45 Also, sp_help can use in any database object in sql server such as table, let we see what information we get if use the following command: sp_help Students
46 Note If we need to know that this procedure that creation what table that depends on it? We use sp_depends Procedure_Name, for example: sp_depends spgetstudentscountbygender
47 SQL Server Lecture 11 String Functions Date & Time
48 String Function
49 String Function: ASCII(Character_Expression): This function returns the ASCII code of the given character expression Example: Select ASCII('A'), ASCII('ABC'), ASCII('BC')
50 CHAR(Integer_Expression): Convert an integer ASCII code to character, the integer_expression should be from 0 to 255. Example: Select CHAR(65), CHAR(97)
51 Example: int Begin /*Select Print Set End Begin Print Set End Begin Print Set End Print the character from (A-Z), (a-z), (0-9).
52 LTRIM(Character_Expression): Remove blanks on the left handside of the given character expression. RTRIM(Character_Expression): Remove blanks on the right handside of the given character expression For the example, let we have the following table:
53 We can use LTRIM as the following: Select Id, LTRIM(FirstName), LastName from Employee4
54 Also, we can use RTRIM: Select Id, RTRIM(FirstName), LastName from Employee4
55 Now, how we can get the following results? Select Id, LTRIM(RTRIM(FirstName))+' '+MiddleName+' '+LastName as FullName From Employee4
56 UPPER(Character_Expression): Convert all the character in the given character expression to the upper case letter. LOWER(Character_Expression): Convert all the character in the given character expression to the lower case letter. Example: if we need to view the pervious example(fullname) but FirstName in the UPPER case and LastName in LOWER case.
57 Select Id, UPPER(LTRIM(RTRIM(FirstName)))+' '+MiddleName+' '+LOWER(LastName) as FullName From Employee4
58 REVERSE(String_Expression): Reverse all the character in the given string expression LEN(String_Expression): Return the count of total character in the given string expression excluding the blank in the end of the expression. Example: View the FirstName in the Employee4 table in the reverse case and then calculate only the character of the FirstName (without blanks).
59 Select REVERSE(FirstName) as ReverseFirstName, LEN(LTRIM(FirstName)) as TotalCharLen From Employee4
60 Date and Time
61 Date & Time DataType in SQL Server There are some datatype that represent time and date and there are: Time: This type have the format hh:mm:ss.[nnnnnnn] with storage size from 3 to 5 bytes. Date: This type have the format YYYY-MM-DD with storage size 3 bytes. Smalldatetime: This type have the format YYYY-MM-DD hh:mm:ss with storage size 4 bytes. Datetime: This type have the format YYYY-MM-DD hh:mm:ss.[nnn] with storage size 8 bytes. Datetime2: This type have the format YYYY-MM-DD hh:mm:ss.[nnnnnnn] with storage size from 6 to 8 bytes. Datetimeoffset: this type have the format YYYY-MM-DD hh:mm:ss.[nnnnnnn] [+ -] hh:mm with storage size from 8 to 10 bytes.
62
63 Date and Time Functions There are many functions that get the time and date and there are represented by the table below:
64 Examples: Let to create the following table(tbldatetimetest): Create table tbldatetimetest ( [c_time] time, [c_date] date, [c_smalldatetime] smalldatetime, [c_datetime] datetime, [c_datetime2] datetime2, [c_datetimeoffset] datetimeoffset )
65 Now, let to insert the following to tbldatetimetest table: Insert into tbldatetimetest values (GETDATE(),GETDATE(),GETDATE(),GETDATE(),GETDATE(),GETDATE()) Then, we execute the following query Select * From tbldatetimetest The result is:
66 Now, how can set c_datetimeoffset with the current time zone (not +00:00)? Update tbldatetimetest set c_datetimeoffset=sysdatetimeoffset()
67 ISDATE: ISDATE( ): Checks if the given value, is valid date, time, or datetime, return (1) for success and (0) for failure. Example:
68 Select ISDATE('Pragin') Select ISDATE(GETDATE()) Select ISDATE(' :43:59.637') Select ISDATE(' :46: ') Note: For datatime2 values, ISDATE( ) return Zero
69 DAY, MONTH, YEAR DAY( ):Return the day number of the month of the given date. MONTH( ): Return the month number of the year of the given date. YEAR( ): Return the year number of the given date.
70 Example: Select DAY(GETDATE()) Select DAY(' ') Select MONTH(GETDATE()) SELECT MONTH(' ') Select YEAR(GETDATE()) Select YEAR(' ')
71 DATENAME( ) Function DATENAME(DatePart,date):Return a string that represents a part of the given date.
72 Example: Select DATENAME(DAY,' :28: ') Select DATENAME(WEEKDAY,' :28: ') Select DATENAME(WEEK,' :28: ') Select DATENAME(MONTH,' :28: ')
73 Example: Let we have the following table (Employee5) And we need to view the following table from above table:
74 Note: To create the table of example we must set the (DateOfBirth) as datetime data type Create Table Employee5 ( Id int primary key identity(1,1), Name nvarchar(30), DateOfBirith datetime ) The solution of this example is: Select Name, DateOfBirth, Datename(Weekday,DateOfBirth) as [Day], Month(DateOfBirth) as MonthNumber, Datename(Month,DateOfBirth) as MonthName, Year(DateOfBirth) as Year From Employee5
75 DATEPART Function DATEPART(DatePart, Date): Return an integer representing the specified DatePart. This function is similar to DATENAME( ) but DATENAME( ) return nvarchar while DATEPART( ) return an integer.
76 Example: Select DATENAME(WEEKDAY,' :56: ') Select DATEPART(WEEKDAY,' :56: ') Select DATENAME(MONTH,' :56: ') Select DATEPART(MONTH,' :56: ')
77 DATEADD Function DATEADD(DatePart, NumberToAdd, Date): Return the DateTime, after adding specified NumberToAdd, to the datepart specified of the given date.
78 Example: Select DATEADD(DAY, 20, ' :45:31.793') Select DATEADD(DAY, -20, ' :45:31.793') Select DATEADD(MONTH, 5, ' :45:31.793') Select DATEADD(YEAR, -2, ' :45:31.793')
79 DATEDIFF Function DATEDIFF(DatePart, StartDate, EndDate): Return the count of the specified datepart boundaries crossed between the specified startdate and enddate. Example: Select DATEDIFF(MONTH, ' ', ' ') Select DATEDIFF(DAY, ' ', ' ')
80 Example: Write a query to calculate the specify birthday in Year, Month, Day Form Example if the birthday of person is ( ) then the results must be view as:
81 int Getdate())- case when Or And Then 1 Else 0 @tempdate)
82 Select Getdate())- case when Then 1 else 0 End Select as as as [Days]
83 Now, how to use this query as a function? To understand this question we remember Employee5 table: And we need to view the following table:
84 At first, create function is similar to create store procedure need a name a parameter that passing to the function At the above query, not need ) but this variable is passing as a parameter to the function as: Create Function fncomputage(@dob DateTime) Returns nvarchar(50) as Begin int.. End
85 Also the last Select statement not need as as as [Days]) but we must declare the output of the function as: nvarchar(50) Set as nvarchar)+' Year as nvarchar)+' Months as nvarchar)+' Day Old'
86 Create Function DateTime) Returns nvarchar(50) as Begin int Getdate())- case when Or And Then 1 Else 0 @tempdate)
87 Select Getdate())- case when Then 1 else 0 End Select nvarchar(50) as nvarchar(4))+' Year '+cast(@months as nvarchar(2))+' Months '+cast(@days as nvarchar(2))+' Day Old' End
88 Now, how to use this function? Select dbo.fncomputage(' ') as Age Now, this function can used to view table which need in this example:
89 Select Id, Name, DateOfBirth, dbo.fncomputage(dateofbirth) as DOB From Employee5
90 SQL Server Lecture 12 Mathematical Function
91 Mathematical Function To see all mathematical function that available in SQL server:
92 ABS(NumericExpression): Return absolute (Positive) number. Select abs(-10.35) CEILING(NumericExpression): Returns the smallest integer value that greater than or equal to the value of the NumericExpression. FLOOR(Numeric Expression): Return the largest integer value that less than or equal to the value of the NumericExpression.
93 Example: Select CEILING (15.2) Select CEILING (15.6) Select CEILING (-15.2) Select FLOOR (-15.6) Select CEILING (-15.6) Select FLOOR (15.2) Select FLOOR (15.6) Select FLOOR (-15.2)
94 POWER(Expression, Power): Return power value of the specified expression to the specified power. Select POWER(2,3) SQUARE(Number): Returns the square of the given number. SQRT(Number): Return the square root of the given number. Select SQUARE(8) Select SQRT(81)
95 RAND(Seed_Value): Return a random float number between 0 and 1. Rand() function return difference random value at each time called if not supplied seed. Rand() function take an optional seed parameter. When a seed_value is supplied, the RAND( ) function always return the same value for the same seed.
96 Example: Select RAND() as [1], RAND() as [2], Rand() as [3] Select RAND(1) as [1], RAND(1) as [2], Rand(1) as [3] Select RAND(2) as [1], RAND(2) as [2], Rand(2) as [3]
97 Example: Print random 10 numbers from 0 to 10 as int While(@Co<=10) Begin Print(Floor(Rand()*100)) End
98 ROUND(NumericExpression, Length, [Function]): Rounds the given numeric_expression based on the given length. This function takes 3 parameters Numeric_Expression: is the number that we want to round. Length: parameter specifies the number of the digits that we want to round. If the length is a positive number, then the rounding is applied for the decimal part. If the length is negative number, then the rounding is applied to the number before decimal. The optional function parameter: is used to indicate rounding, or truncation operation. 0 indicate rounding (default). Non zero indicate truncation.
99 Example: Select Round( , 2) Select Round( , 2, 1) Select Round( , 1) Select Round( , 1, 1) Select Round( , -2) Select Round( , -2) Select Round( , -1) Select Round( , -1) Select Round( , -3) Select Round( , -2)
This course is aimed at those who need to extract information from a relational database system.
(SQL) SQL Server Database Querying Course Description: This course is aimed at those who need to extract information from a relational database system. Although it provides an overview of relational database
More informationReporting Functions & Operators
Functions Reporting Functions & Operators List of Built-in Field Functions Function Average Count Count Distinct Maximum Minimum Sum Sum Distinct Return the average of all values within the field. Return
More informationSQL SERVER DATE TIME FONKSİYON
SQL SERVER DATE TIME FONKSİYON - Get date only from datetime - QUICK SYNTAX SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, CURRENT_TIMESTAMP)) -- 2016-10-23 00:00:00.000 -- SQL Server T-SQL date & datetime formats
More informationAdvanced SQL. Chapter 8 finally!
Advanced SQL Chapter 8 finally! Views (okay so this is Ch 7) We've been saving SQL queries by saving text files Isn't there a better way? Views! basically saved SELECT queries Syntax CREATE VIEW viewname
More informationPrivate Institute of Aga NETWORK DATABASE LECTURER NIYAZ M. SALIH
Private Institute of Aga 2018 NETWORK DATABASE LECTURER NIYAZ M. SALIH Data Definition Language (DDL): String data Types: Data Types CHAR(size) NCHAR(size) VARCHAR2(size) Description A fixed-length character
More informationWorking with dates and times in SQL Server
Working with dates and times in SQL Server SQL Server gives you plenty of power for working with dates, times and datetimes. Tamar E. Granor, Ph.D. One of the things that makes VFP easy to work with is
More informationUnit 1 - Chapter 4,5
Unit 1 - Chapter 4,5 CREATE DATABASE DatabaseName; SHOW DATABASES; USE DatabaseName; DROP DATABASE DatabaseName; CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype,... columnn
More informationConstraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2
CMPT 354 Constraints Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers John Edgar 2 firstname type balance city customerid lastname accnumber rate branchname phone
More informationDATABASE MANAGEMENT SYSTEMS
DATABASE MANAGEMENT SYSTEMS Associate Professor Dr. Raed Ibraheem Hamed University of Human Development, College of Science and Technology Departments of IT and Computer Science 2015 2016 1 The ALTER TABLE
More informationUNIT III INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL)
UNIT III INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) 3.1Data types 3.2Database language. Data Definition Language: CREATE,ALTER,TRUNCATE, DROP 3.3 Database language. Data Manipulation Language: INSERT,SELECT,UPDATE,DELETE
More informationSenturus Analytics Connector. User Guide Cognos to Power BI Senturus, Inc. Page 1
Senturus Analytics Connector User Guide Cognos to Power BI 2019-2019 Senturus, Inc. Page 1 Overview This guide describes how the Senturus Analytics Connector is used from Power BI after it has been configured.
More informationMANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 3 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA
More informationProphet 21 World Wide User Group Webinars. Barry Hallman. SQL Queries & Views. (Part 2)
Prophet 21 World Wide User Group Webinars SQL Queries & Views (Part 2) Barry Hallman Disclaimer This webinar is an attempt by P21WWUG members to assist each other by demonstrating ways that we utilize
More informationEvery Byte Counts. Why Datatype Choices Matter. Andy Yun, Database Architect/Developer
Every Byte Counts Why Datatype Choices Matter Andy Yun, Database Architect/Developer Thank You Presenting Sponsors Gain insights through familiar tools while balancing monitoring and managing user created
More informationSQL Data Definition Language: Create and Change the Database Ray Lockwood
Introductory SQL SQL Data Definition Language: Create and Change the Database Pg 1 SQL Data Definition Language: Create and Change the Database Ray Lockwood Points: DDL statements create and alter the
More informationLab # 4. Data Definition Language (DDL)
Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Lab # 4 Data Definition Language (DDL) Eng. Haneen El-Masry November, 2014 2 Objective To be familiar with
More informationSQL Server 2008 Tutorial 3: Database Creation
SQL Server 2008 Tutorial 3: Database Creation IT 5101 Introduction to Database Systems J.G. Zheng Fall 2011 DDL Action in SQL Server Creating and modifying structures using the graphical interface Table
More informationT- SQL Lab Exercises and Examples
T- SQL Lab Exercises and Examples Table of Contents 1. T-SQL - OVERVIEW... 4 2. T-SQL SERVER - DATA TYPES... 5 3. T-SQL SERVER - CREATE TABLES... 8 4. T-SQL SERVER - DROP TABLES... 10 5. T-SQL SERVER -
More informationCreating SQL Server Stored Procedures CDS Brownbag Series CDS
Creating SQL Server Stored Procedures Paul Litwin FHCRC Collaborative Data Services CDS Brownbag Series This is the 11th in a series of seminars Materials for the series can be downloaded from www.deeptraining.com/fhcrc
More informationSenturus Analytics Connector. User Guide Cognos to Tableau Senturus, Inc. Page 1
Senturus Analytics Connector User Guide Cognos to Tableau 2019-2019 Senturus, Inc. Page 1 Overview This guide describes how the Senturus Analytics Connector is used from Tableau after it has been configured.
More informationINTRODUCTION TO MYSQL MySQL : It is an Open Source RDBMS Software that uses Structured Query Language. It is available free of cost. Key Features of MySQL : MySQL Data Types: 1. High Speed. 2. Ease of
More informationDatabase Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved.
Database Foundations 6-4 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control
More informationEGCI 321: Database Systems. Dr. Tanasanee Phienthrakul
1 EGCI 321: Database Systems Dr. Tanasanee Phienthrakul 2 Chapter 10 Data Definition Language (DDL) 3 Basic SQL SQL language Considered one of the major reasons for the commercial success of relational
More informationIslamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng.
Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Ahmed Abumarasa Database Lab Lab 2 Database Table Introduction: The previous
More informationBEGINNING T-SQL. Jen McCown MidnightSQL Consulting, LLC MinionWare, LLC
BEGINNING T-SQL Jen McCown MidnightSQL Consulting, LLC MinionWare, LLC FIRST: GET READY 1. What to model? 2. What is T-SQL? 3. Books Online (BOL) 4. Transactions WHAT TO MODEL? What kind of data should
More informationSQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas
SQL SQL Functionality stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original
More informationCardkey Systems, Inc. Cardkey PEGASYS 1000 and 2000 MIS Interface Program 8K\OYOUT',KHX[GX_
Cardkey Systems, Inc. Cardkey PEGASYS 1000 and 2000 MIS Interface Program )GXJQK_3/9/TZKXLGIK /TYZGRRGZOUTGTJ)UTLOM[XGZOUT 8K\OYOUT',KHX[GX_ )GXJQK_9_YZKSY/TI :GVU)GT_UT8UGJ9OSO
More informationOverview. Implementing Stored Procedures Creating Parameterized Stored Procedures Working With Execution Plans Handling Errors
إعداد د. عبدالسالم منصور الشريف 1 Overview Implementing Stored Procedures Creating Parameterized Stored Procedures Working With Execution Plans Handling Errors 2 1 Lesson 1: Implementing Stored Procedures
More informationInformation Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language
Information Systems Engineering SQL Structured Query Language DDL Data Definition (sub)language 1 SQL Standard Language for the Definition, Querying and Manipulation of Relational Databases on DBMSs Its
More informationLab # 2. Data Definition Language (DDL) Eng. Alaa O Shama
The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 2 Data Definition Language (DDL) Eng. Alaa O Shama October, 2015 Objective To be familiar
More informationFull file at
ch2 True/False Indicate whether the statement is true or false. 1. The SQL command to create a database table is an example of DML. 2. A user schema contains all database objects created by a user. 3.
More informationActivant Solutions Inc. SQL 2005: Basic Data Manipulation
Activant Solutions Inc. SQL 2005: Basic Data Manipulation SQL Server 2005 suite Course 4 of 4 This class is designed for Beginner/Intermediate SQL Server 2005 System Administrators Objectives System Stored
More informationSQL Server Administration Class 4 of 4. Activant Prophet 21. Basic Data Manipulation
SQL Server Administration Class 4 of 4 Activant Prophet 21 Basic Data Manipulation This class is designed for Beginner SQL/Prophet21 users who are responsible for SQL Administration as it relates to Prophet
More informationMySQL and MariaDB. March, Introduction 3
MySQL and MariaDB March, 2018 Contents 1 Introduction 3 2 Starting SQL 3 3 Databases 3 i. See what databases exist........................... 3 ii. Select the database to use for subsequent instructions..........
More informationDepartment of Computer Science University of Cyprus. EPL342 Databases. Lab 2
Department of Computer Science University of Cyprus EPL342 Databases Lab 2 ER Modeling (Entities) in DDS Lite & Conceptual Modeling in SQL Server 2008 Panayiotis Andreou http://www.cs.ucy.ac.cy/courses/epl342
More informationHOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL
HOW TO CREATE AND MAINTAIN DATABASES AND TABLES By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate
More informationRelational Database Language
DATA BASE MANAGEMENT SYSTEMS Unit IV Relational Database Language: Data definition in SQL, Queries in SQL, Insert, Delete and Update Statements in SQL, Views in SQL, Specifying General Constraints as Assertions,
More informationUsing DbVisualizer Variables
Using DbVisualizer Variables DbVisualizer variables are used to build parameterized SQL statements and let DbVisualizer prompt you for the values when the SQL is executed. This is handy if you are executing
More informationStructured Query Language
University College of Southeast Norway Structured Query Language Hans-Petter Halvorsen, 2016.01.08 The Tutorial is available Online: http://home.hit.no/~hansha/?tutorial=sql http://home.hit.no/~hansha
More informationAdvanced SQL Tribal Data Workshop Joe Nowinski
Advanced SQL 2018 Tribal Data Workshop Joe Nowinski The Plan Live demo 1:00 PM 3:30 PM Follow along on GoToMeeting Optional practice session 3:45 PM 5:00 PM Laptops available What is SQL? Structured Query
More informationDownloaded from
Lesson 16: Table and Integrity Constraints Integrity Constraints are the rules that a database must follow at all times. Various Integrity constraints are as follows:- 1. Not Null: It ensures that we cannot
More informationDatatype-Related Problems, XML, and CLR UDTs
Chapter 1 Datatype-Related Problems, XML, and CLR UDTs In this chapter: DATETIME Datatypes..................................................... 2 Character-Related Problems..............................................25
More informationStored Procedures and Functions. Rose-Hulman Institute of Technology Curt Clifton
Stored Procedures and Functions Rose-Hulman Institute of Technology Curt Clifton Outline Stored Procedures or Sprocs Functions Statements Reference Defining Stored Procedures Named Collections of Transact-SQL
More informationSQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210
SQL: Concepts Todd Bacastow IST 210: Organization of Data 2/17/2004 1 Design questions How many entities are there? What are the major entities? What are the attributes of each entity? Is there a unique
More informationIndex. Symbol function, 391
Index Symbol @@error function, 391 A ABP. See adjacent broker protocol (ABP) ACID (Atomicity, Consistency, Isolation, and Durability), 361 adjacent broker protocol (ABP) certificate authentication, 453
More informationLab # 2 Hands-On. DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia
Lab # 2 Hands-On DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia Part A: Demo by Instructor in Lab a. Data type of MySQL b. CREATE table c. ALTER table (ADD, CHANGE,
More informationChapter-14 SQL COMMANDS
Chapter-14 SQL COMMANDS What is SQL? Structured Query Language and it helps to make practice on SQL commands which provides immediate results. SQL is Structured Query Language, which is a computer language
More informationBasic SQL. Basic SQL. Basic SQL
Basic SQL Dr Fawaz Alarfaj Al Imam Mohammed Ibn Saud Islamic University ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation Basic SQL Structured
More informationExact Numeric Data Types
SQL Server Notes for FYP SQL data type is an attribute that specifies type of data of any object. Each column, variable and expression has related data type in SQL. You would use these data types while
More informationDatabase Management Systems,
Database Management Systems SQL Query Language (1) 1 Topics Introduction SQL History Domain Definition Elementary Domains User-defined Domains Creating Tables Constraint Definition INSERT Query SELECT
More informationSQL FUNCTIONS. Prepared By:Dr. Vipul Vekariya.
SQL FUNCTIONS Prepared By:Dr. Vipul Vekariya. SQL FUNCTIONS Definition of Function Types of SQL Function Numeric Function String Function Conversion Function Date Function SQL Function Sub program of SQL
More informationD B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity
SQL language: basics Creating a table Modifying table structure Deleting a table The data dictionary Data integrity 2013 Politecnico di Torino 1 Creating a table Creating a table (1/3) The following SQL
More informationSQL Data Definition Language
SQL Data Definition Language André Restivo 1 / 56 Index Introduction Table Basics Data Types Defaults Constraints Check Not Null Primary Keys Unique Keys Foreign Keys Sequences 2 / 56 Introduction 3 /
More informationDatabase Systems Laboratory 2 SQL Fundamentals
Database Systems Laboratory 2 another from another School of Computer Engineering, KIIT University 2.1 1 2 3 4 5 6 7 8 another from another 9 another 10 from another 11 2.2 Student table Roll Name City
More informationCS 327E Lecture 2. Shirley Cohen. January 27, 2016
CS 327E Lecture 2 Shirley Cohen January 27, 2016 Agenda Announcements Homework for today Reading Quiz Concept Questions Homework for next time Announcements Lecture slides and notes will be posted on the
More informationDatabase Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.
Database Foundations 6-3 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control
More information1) Introduction to SQL
1) Introduction to SQL a) Database language enables users to: i) Create the database and relation structure; ii) Perform insertion, modification and deletion of data from the relationship; and iii) Perform
More informationProgramming and Database Fundamentals for Data Scientists
Programming and Database Fundamentals for Data Scientists Database Fundamentals Varun Chandola School of Engineering and Applied Sciences State University of New York at Buffalo Buffalo, NY, USA chandola@buffalo.edu
More informationUnit 27 Web Server Scripting Extended Diploma in ICT
Unit 27 Web Server Scripting Extended Diploma in ICT Dynamic Web pages Having created a few web pages with dynamic content (Browser information) we now need to create dynamic pages with information from
More information2.9 Table Creation. CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... )
2.9 Table Creation CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... ) CREATE TABLE Addresses ( id INTEGER, name VARCHAR(20), zipcode CHAR(5), city VARCHAR(20), dob DATE ) A list of valid
More informationData Base Lab. The Microsoft SQL Server Management Studio Part-3- By :Eng.Alaa I.Haniy.
Data Base Lab Islamic University Gaza Engineering Faculty Computer Department Lab -5- The Microsoft SQL Server Management Studio Part-3- By :Eng.Alaa I.Haniy. SQL Constraints Constraints are used to limit
More informationOverview of MySQL Structure and Syntax [2]
PHP PHP MySQL Database Overview of MySQL Structure and Syntax [2] MySQL is a relational database system, which basically means that it can store bits of information in separate areas and link those areas
More informationBuilding Better. SQL Server Databases
Building Better SQL Server Databases Who is this guy? Eric Cobb Started in IT in 1999 as a "webmaster Developer for 14 years Microsoft Certified Solutions Expert (MCSE) Data Platform Data Management and
More informationCreating a Relational Database Using Microsoft SQL Code. Farrokh Alemi, Ph.D.
Creating a Relational Database Using Microsoft SQL Code Farrokh Alemi, Ph.D. The objective of this note is to help you understand how a relational database is organized as a collection of tables, linked
More informationHonors Computer Science C++ Mr. Clausen Program 3A, 3B, 3C
Honors Computer Science C++ Mr. Clausen Program 3A, 3B, 3C Program 3A Cone Heads (25 points) Write a program to calculate the volume and surface area of a right circular cone. Allow the user to enter values
More informationColdFusion Summit 2016
ColdFusion Summit 2016 Building Better SQL Server Databases Who is this guy? Eric Cobb - Started in IT in 1999 as a "webmaster - Developer for 14 years - Microsoft Certified Solutions Expert (MCSE) - Data
More informationChapter-8 DATA TYPES. Introduction. Variable:
Chapter-8 DATA TYPES Introduction To understand any programming languages we need to first understand the elementary concepts which form the building block of that program. The basic building blocks include
More informationWhat are temporary tables? When are they useful?
What are temporary tables? When are they useful? Temporary tables exists solely for a particular session, or whose data persists for the duration of the transaction. The temporary tables are generally
More informationSAM Ad-Hoc. Gives direct, near unrestricted (view-only) access to your SAM database Ability to see raw data with queries created by you.
SAM Ad-Hoc Gives direct, near unrestricted (view-only) access to your SAM database Ability to see raw data with queries created by you. Four Clauses of a Query SELECT Describes the columns that will be
More information2 PL/SQL - fundamentals Variables and Constants Operators SQL in PL/SQL Control structures... 7
Table of Contents Spis treści 1 Introduction 1 2 PLSQL - fundamentals 1 2.1 Variables and Constants............................ 2 2.2 Operators.................................... 5 2.3 SQL in PLSQL.................................
More informationMore MySQL ELEVEN Walkthrough examples Walkthrough 1: Bulk loading SESSION
SESSION ELEVEN 11.1 Walkthrough examples More MySQL This session is designed to introduce you to some more advanced features of MySQL, including loading your own database. There are a few files you need
More informationLecture 07. Spring 2018 Borough of Manhattan Community College
Lecture 07 Spring 2018 Borough of Manhattan Community College 1 SQL Identifiers SQL identifiers are used to identify objects in the database, such as table names, view names, and columns. The ISO standard
More informationThe Relational Model
The Relational Model What is the Relational Model Relations Domain Constraints SQL Integrity Constraints Translating an ER diagram to the Relational Model and SQL Views A relational database consists
More informationuser specifies what is wanted, not how to find it
SQL stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original ANSI SQL updated
More informationSELF TEST. List the Capabilities of SQL SELECT Statements
98 SELF TEST The following questions will help you measure your understanding of the material presented in this chapter. Read all the choices carefully because there might be more than one correct answer.
More informationSQL Server. Lecture3 Cascading referential integrity constraint
SQL Server Lecture3 Cascading referential integrity constraint insert into tblperson values (4,'May','Ma@m.com',4) Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY
More informationSimple Quesries in SQL & Table Creation and Data Manipulation
Simple Quesries in SQL & Table Creation and Data Manipulation Based on CBSE Curriculum Class -11 By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region Neha Tyagi, PGT CS II Shift Jaipur Introduction
More informationModule 8: Implementing Stored Procedures
Module 8: Implementing Stored Procedures Table of Contents Module Overview 8-1 Lesson 1: Implementing Stored Procedures 8-2 Lesson 2: Creating Parameterized Stored Procedures 8-10 Lesson 3: Working With
More informationOutline. Data and Operations. Data Types. Integral Types
Outline Data and Operations Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and Operations Data and Operations
More informationSQL Commands & Mongo DB New Syllabus
Chapter 15 : Computer Science Class XI ( As per CBSE Board) SQL Commands & Mongo DB New Syllabus 2018-19 SQL SQL is an acronym of Structured Query Language.It is a standard language developed and used
More information7. Data Privacy Option for Oracle E-Business Suite
7. Data Privacy Option for Oracle E-Business Suite This section contains information on using the Optim Data Privacy option in conjunction with the Optim Test Data Management Solution for Oracle E-Business
More informationThe Math Class. Using various math class methods. Formatting the values.
The Math Class Using various math class methods. Formatting the values. The Math class is used for mathematical operations; in our case some of its functions will be used. In order to use the Math class,
More informationMicrosoft Exam Querying Microsoft SQL Server 2012 Version: 13.0 [ Total Questions: 153 ]
s@lm@n Microsoft Exam 70-461 Querying Microsoft SQL Server 2012 Version: 13.0 [ Total Questions: 153 ] Question No : 1 CORRECT TEXT Microsoft 70-461 : Practice Test You have a database named Sales that
More informationOracle 1Z MySQL 5.6 Developer.
Oracle 1Z0-882 MySQL 5.6 Developer http://killexams.com/exam-detail/1z0-882 SELECT... WHERE DATEDIFF (dateline, 2013-01-01 ) = 0 C. Use numeric equivalents for comparing the two dates: SELECT...WHERE MOD(UNIX_TIMESTAMP
More informationLecture 3. Review. CS 141 Lecture 3 By Ziad Kobti -Control Structures Examples -Built-in functions. Conditions: Loops: if( ) / else switch
Lecture 3 CS 141 Lecture 3 By Ziad Kobti -Control Structures Examples -Built-in functions Review Conditions: if( ) / else switch Loops: for( ) do...while( ) while( )... 1 Examples Display the first 10
More informationInteger Data Types. Data Type. Data Types. int, short int, long int
Data Types Variables are classified according to their data type. The data type determines the kind of information that may be stored in the variable. A data type is a set of values. Generally two main
More informationMySQL Workshop. Scott D. Anderson
MySQL Workshop Scott D. Anderson Workshop Plan Part 1: Simple Queries Part 2: Creating a database: creating a table inserting, updating and deleting data handling NULL values datatypes Part 3: Joining
More informationData Types in MySQL CSCU9Q5. MySQL. Data Types. Consequences of Data Types. Common Data Types. Storage size Character String Date and Time.
- Database P&A Data Types in MySQL MySQL Data Types Data types define the way data in a field can be manipulated For example, you can multiply two numbers but not two strings We have seen data types mentioned
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationIntroduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018
Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018 Background Information 2 Background Information What is a (Relational) Database 3 Dynamic collection of information. Organized into tables,
More informationPhụ lục 2. Bởi: Khoa CNTT ĐHSP KT Hưng Yên. Returns the absolute value of a number.
Phụ lục 2 Bởi: Khoa CNTT ĐHSP KT Hưng Yên Language Element Abs Function Array Function Asc Function Atn Function CBool Function CByte Function CCur Function CDate Function CDbl Function Chr Function CInt
More informationMTAT Introduction to Databases
MTAT.03.105 Introduction to Databases Lecture #3 Data Types, Default values, Constraints Ljubov Jaanuska (ljubov.jaanuska@ut.ee) Lecture 1. Summary SQL stands for Structured Query Language SQL is a standard
More informationGlobAl EDITION. Database Concepts SEVENTH EDITION. David M. Kroenke David J. Auer
GlobAl EDITION Database Concepts SEVENTH EDITION David M. Kroenke David J. Auer This page is intentionally left blank. Chapter 3 Structured Query Language 157 the comment. We will use similar comments
More informationDeepak Bhinde PGT Comp. Sc.
Deepak Bhinde PGT Comp. Sc. SQL Elements in MySQL Literals: Literals refers to the fixed data value. It may be Numeric or Character. Numeric literals may be integer or real numbers and Character literals
More informationDB2 Function Conversion for Sybase ASE Users
DB2 Function Conversion for Sybase ASE Users ChangSung KANG, Kitty Lau IMTE Version 1.2 Date: July-01-2011 Page:1 Version: 1.1 Document History Version Date Author Comment Authorization 1.0 07/01/2011
More informationChapter 13 : Informatics Practices. Class XI ( As per CBSE Board) SQL Commands. New Syllabus Visit : python.mykvs.in for regular updates
Chapter 13 : Informatics Practices Class XI ( As per CBSE Board) SQL Commands New Syllabus 2018-19 SQL SQL is an acronym of Structured Query Language.It is a standard language developed and used for accessing
More informationBasis Data Terapan. Yoannita
Basis Data Terapan Yoannita SQL Server Data Types Character strings: Data type Description Storage char(n) varchar(n) varchar(max) text Fixed-length character string. Maximum 8,000 characters Variable-length
More informationSome Basic Aggregate Functions FUNCTION OUTPUT The number of rows containing non-null values The maximum attribute value encountered in a given column
SQL Functions Aggregate Functions Some Basic Aggregate Functions OUTPUT COUNT() The number of rows containing non-null values MIN() The minimum attribute value encountered in a given column MAX() The maximum
More informationPractical 8. SHANKER SINH VAGHELA BAPU INSTITUTE OF TECHNOLGY Subject: - DBMS Branch: - IT/CE Semester: - 3rd. 1. What does SQL stand for?
Practical 8 1. What does SQL stand for? Structured Query Language Strong Question Language Structured Question Language 2. Which SQL statement is used to extract data from a database? OPEN SELECT GET EXTRACT
More informationStructure Query Language (SQL)
Structure Query Language (SQL) 1 6.12.2 OR operator OR operator is also used to combine multiple conditions with Where clause. The only difference between AND and OR is their behavior. When we use AND
More information