Migrirajte na Innovate Summit:
Saznajte kako migracija i modernizacija na Azure mogu poboljšati performanse, otpornost i sigurnost vaše tvrtke, omogućujući vam da u potpunosti prihvatite umjetnu inteligenciju.Registrirajte se odmah
Ovaj preglednik više nije podržan.
Prijeđite na Microsoft Edge, gdje vas čekaju najnovije značajke, sigurnosna ažuriranja i tehnička podrška.
Azure SQL Database creates an IP firewall at the server-level. This firewall prevents external applications and tools from connecting to the server and any databases on the server unless a firewall rule allows their IP through the firewall. To enable external connectivity to your database, you must first add an IP firewall rule for your IP address (or IP address range). Follow these steps to create a server-level IP firewall rule.
Važno
Azure SQL Database communicates over port 1433. If you are trying to connect to this service from within a corporate network, outbound traffic over port 1433 may not be allowed by your network's firewall. If so, you cannot connect to your database unless your administrator opens port 1433.
After the deployment completes, select SQL databases from the Azure portal menu or search for and select SQL databases from any page.
Select yourDatabase on the SQL databases page. The overview page for your database opens, showing you the fully qualified Server name (such as contosodatabaseserver01.database.windows.net) and provides options for further configuration.
Copy this fully qualified server name for use to connect to your server and databases from SQL Server Management Studio.
Select Networking under Settings. Choose the Public Access tab, and then select Selected networks under Public network access to display the Firewall rules section.
Select Add your client IPv4 on the toolbar to add your current IP address to a new IP firewall rule. An IP firewall rule can open port 1433 for a single IP address or a range of IP addresses.
Select Save. A server-level IP firewall rule is created for your current IP address opening port 1433 on the server.
Select OK and then close the Firewall settings page.
Your IP address can now pass through the IP firewall. You can now connect to your database using SQL Server Management Studio or another tool of your choice. Be sure to use the server admin account you created previously.
Važno
By default, access through the SQL Database IP firewall is enabled for all Azure services. Select OFF on this page to disable for all Azure services.
Connect to the database
Azure SQL databases exist inside logical SQL servers. Can connect to the logical SQL server's master using a login, then connect to your database. Or, using a contained user, you can connect directly to your Azure SQL database.
On your SQL database Overview page in the Azure portal, select Query editor (preview) from the left menu.
On the sign-in screen under Welcome to SQL Database Query Editor, provide credentials to connect to the database. You can connect using SQL or Microsoft Entra authentication.
To connect with SQL authentication, under SQL server authentication, enter a Login and Password for a user that has access to the database, and then select OK. You can always use the login and password for the server admin.
To connect using Microsoft Entra ID, if you're the Microsoft Entra server admin, select Continue as <your user or group ID>. If sign-in is unsuccessful, try refreshing the page.
A new query window opens, ready to accept T-SQL commands. In the object explorer, you can expand folders for Tables, Views, and Stored procedures.
Create tables in your database
Create four tables that model a student management system for universities using Transact-SQL:
Person
Course
Student
Credit
The following diagram shows how these tables are related to each other. Some of these tables reference columns in other tables. For example, the Student table references the PersonId column of the Person table. Study the diagram to understand how the tables in this tutorial are related to one another. For an in-depth look at how to create effective normalized database tables, see Designing a Normalized Database. For information about choosing data types, see Data types. By default, tables are created in the default dbo schema, meaning the two-part name of a table will be dbo.Person, for example.
Expand the Tables node under yourDatabase in the Object Explorer to see the four new tables you created.
Load data into the tables
Create a folder called sampleData in your local workstation Downloads folder to store sample data for your database. For example, c:\Users\<your user name>\Downloads.
Right-click the following links and save them into the sampleData folder.
Open a new Windows command prompt window and navigate to the sampleData folder. For example, cd c:\Users\<your user name>\Downloads.
Execute the following bcp commands to insert sample data into the tables replacing the values for server, database, user, and password with the values for your environment.
You have now loaded sample data into the tables you created earlier.
Query data
Execute the following T-SQL queries to retrieve information from the database tables.
This first query joins all four tables to find the students taught by 'Dominick Pope' who have a grade higher than 75%. In a query window, execute the following T-SQL query:
SQL
-- Find the students taught by Dominick Pope who have a grade higher than 75%SELECT person.FirstName, person.LastName, course.Name, credit.Grade
FROM Person AS person
INNERJOIN Student AS student ON person.PersonId = student.PersonId
INNERJOIN Credit AS credit ON student.StudentId = credit.StudentId
INNERJOIN Course AS course ON credit.CourseId = course.courseId
WHERE course.Teacher = 'Dominick Pope'AND Grade > 75;
This query joins all four tables and finds the courses in which 'Noe Coleman' has ever enrolled. In a query window, execute the following T-SQL query:
SQL
-- Find all the courses in which Noe Coleman has ever enrolledSELECT course.Name, course.Teacher, credit.Grade
FROM Course AS course
INNERJOIN Credit AS credit ON credit.CourseId = course.CourseId
INNERJOIN Student AS student ON student.StudentId = credit.StudentId
INNERJOIN Person AS person ON person.PersonId = student.PersonId
WHERE person.FirstName = 'Noe'AND person.LastName = 'Coleman';
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.
Azure SQL is a family of SQL Server database engine products in the cloud, from a fully managed database in Azure SQL Database, a fully managed instance in Azure SQL Managed Instance, or SQL Server installed to virtual machine in Azure.