文件名称:
A Step By Step Guide To Learning SQL
开发工具:
文件大小: 1mb
下载次数: 0
上传时间: 2019-02-23
详细说明:SQL 是用于访问和处理数据库的标准的计算机语言。
<<一步一步学习sql语言>>,英文书籍,pdf版本Contents
Chapter 1: Welcome to SQL
Chapter 2: Install SQL Server
Chapter 3: Creating a Table and Inserting Data
Chapter 4: Querying the Table
Chapter 5: Aggregating Data
Chapter 6: Using the And/Or Function
Chapter 7: Querying IN Subqueries
Chapter 8: Use HAVING to Restrict Group Results
Chapter 9: Use CAse to Calculate Results
Chapter 10: Separating Data into Related Tables
Chapter 11: JOIN Related Tables
Chapter 12: Joining Tables with Left Outer Joins
Chapter 13: Joining Tables with Themselves Using Self-Joins
Chapter 14: Multiple Joins
Chapter 15: Update and Delete
Chapter 16: Altering Tables
Chapter 17:replication
Chapter 18: Granting Privileges
Conclusion
O Copyright 2014 by Malcolm Schwartz All rights reserved
This document is geared towards providing exact and reliable information in
regards to the topic and issue covered. The publication is sold with the idea
that the publisher is not required to render accounting, officially permitted, or
otherwise, qualified services. If advice is necessary legal or professional, a
practiced individual in the profession should be ordered
From a Declaration of Principles which was accepted and approved equally
y a Committee of the american Bar Association and a committee of
Publishers and associations
In no way is it legal to reproduce, duplicate, or transmit any part of this
document in either electronic means or in printed format. Recording of this
publication is strictly prohibited and any storage of this document is not
allowed unless with written permission from the publisher. All rights reserved
The information provided herein is stated to be truthful and consistent, in that
any liability, in terms of inattention or otherwise, by any usage or abuse of any
policies, processes, or directions contained within is the solitary and utter
responsibility of the recipient reader. Under no circumstances will any legal
responsibility or blame be held against the publisher for any reparation,
damages, or monetary loss due to the information herein, either directly or
indirectly
Respective authors own all copyrights not held by the publisher.
he information herein is offered for informational purposes solely, and is
universal as so. The presentation of the information is without contract or any
type of guarantee assurance
The trademarks that are used are without any consent, and the publication of
the trademark is without permission or backing by the trademark owner. All
trademarks and brands within this book are for clarifying purposes only and
are the owned by the owners themselves, not affiliated with this document
Chapter 1: Welcome to SQL
Every app that you use is full of data. Apps store great amounts of data about users
and their transactions. Social media apps store data about users, their interests, and
their friends. Banks store financial and personal-user data. All apps store data by using
a database. Databases are programs that store information and have functions for
adding, changing and querying, and deleting data
There are many different types of databases; a particularly popular type of database is
called a relational database. This stores each type of data in"tables, " similar to
organizing data in a spreadsheet. A row embodies an item, and a column contains
properties about an item. For instance, in order to store data about app users, you could
create a Users' table with a single row for each user and several columns containing
information about the users. a relational database makes it easy to create relationships
but you could also use simple tables. In order to store information in an app, such as
users and their contact information, you could create a user table a contact Table, and
a User- Contact table to keep track of users' contact data, by simply linking user IDs to
contact IDs. That is a more efficient way to store information than repeating everything
about a user and everything about their contact information in the User-Contact table. a
special "query language " is required in order to interact with a database
SQLis the most widely-used language for interacting with databases SQL allows you
to create tables, add data, change data, and retrieve data If you wanted to find out which
users joined your membership website in the past week, you could use SQl to query the
database for that specific information, rather than searching on your own through
massive amounts of data. This is what you will learn in this book. After learning SQl
you' ll have an understanding of how data is stored in apps, and how to use SQL to build
a database
e SQL was invented at IBM in the early 1970s. The first version was called SEQUEL
and it stood for Structured English QUEry Language. It was later changed to SQL
because sEquel was already trademarked by an airplane company. Today, many of us
still pronounce it"sequel, "because it is shorter to say, and we have historical reasons to
claim that it is the right way. In non-English languages, many developers pronounce it
S-Q-L, or, for example, "ese-cu-ele?"in Spanish. Now you know that it can be SQ-L
sequel, and you will probably hear both for the rest of your life
Chapter 2: Install SQL Server
This book can be used as a standalone reference or a hands-on guide for using SQL
In order to follow along on your own computer, you will need to download and instal
SQL Server. The free microsoft version can be obtained here
https://support.microsoftcom/en-us/kb/2681562.Thislinkalsoincludesacompletelist
of instructions
Chapter 3: Creating a Table and Inserting data
Now that you have installed Ms SQL Server, open a new database. This new database
has no data in it yet, so we will populate it together. Our first table will contain a list of
common ingredients. Our first bit of sequel will be the command to create the table to
store this list.Type“ Create table” in all caps, then the name of the table“ Ingredients,”
and then parenthesis and a semicolon. This will cause an error to pop up, because a
sequel interpreter expects to see column names inside these parentheses. For our first
column we need a name for the item which we will call "name ' and we need to follow
that with a data kind. There are many options for data kind, and we will choose text. If
we look on the right hand side we can see our new table is listed with one column But
we also need to specify how many of each thing to buy. So we will create a quantity
column as well. This will always be a whole number, so we will use integer for that data
kind. now we can see that new column listed in our table
That looks pretty good if we are thinking about what data we have in this grocery list,
but we are missing something that we need in all database tables, a unique identifier for
each row. We need unique ids for each row in database because we need a way to
identify rows later when we are updating or deleting them
We do not want to be dependent on other columns, because those could change. We
typically specify this ID column first, so we will move our cursor before name. We will
call this column ID. Then for the data kind, we will have to write this phrase "Integer
Primary Key, which signals to the database that it should treat this as the row
identifier, and that each row must have unique value for this column. Now we have our
ingredients table with three columns in it. It is empty though, so we will put some data
init. Write“ Insert into” and then the table name“ ingredients”.Then“ values”, and then
parentheses
Here, we start listing the column values in order that we declare the columns. The
first column was ID, so we will put one. We haven' t used that ID yet. The second
column is name, so we will write blueberries. The third column was quantity so we will
write four. Notice how the schema updates on the right. Now it says that there is one
row in the ingredients table. So our insertion worked. We will do the same thing with
the next two items. Insert into ingredients, values, two, and mixed Nuts. Insert into
ingredients, values, and ID three, Chocolate Chips. We will get two of those. Now it
says three rows. But to really see that the database actually contains data, you can click
the table name on the right. This will insert a select statement in your code
Don't worry too much about this now, because we will get to this in the next section
That's it! That's all we need to create our first table and add data to it. in the next
section, we will show how to get the data back out of the table
/**k Grocery list: Blueberries(4)
Database schema
Mixed Nuts(1)
Chocolate Chips(2)
CREATE TABLE ingredients(id INTEGER PRIMARY
KEY, name TEXT, quantity INTEGER )
INSERT INTO ingredients VALUES(1, "Blueberries", Results
4);
INSERT INTO ingredients VaLUES(2, Mixed Nuts
1)
INSERT INTO ingredients VALUES(3, " Chocolate
Chips
SELECT*FROM ingredients
Ingredlents
rows
id(PK)
INTEGER
name
TEXT
quantity
INTEGER
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.