SQL Server Database Creation, Tables and Relationships | SQL Server Management Studio



SQL Server Database Creation, Tables and Relationships | SQL Server Management Studio

SQL Server Database Creation, Tables and Relationships | SQL Server Management Studio

SQL Server Management Studio Database Creation, Creating Tables and Relationships. All you need to know about SQL Server Database Creation operations are explained in this video.

Please subscribe ❤️ …and turn on notifications! 🔔

Video Transcript:
Hi, I’m Muhammad Asif, and we’ll see how to create databases, tables, and relations using SQL server management studio. If you’re new to this channel, please subscribe to the youtube channel to support the work and to receive more videos like this.
So, let’s back to the topic. To create a database, tables, and relations, we would need to translate the requirements into a physical model that is deciding table names, their relationships, primary key, and foreign keys by carefully analyzing the requirements.
After creating the database’s physical model, Open SQL server management studio, I’ve created separate videos if you’re facing any issues in SQL management studio database connection.
Expand the databases, right-click on the database folder and select New Database
Enter the database name and then click on the OK button
A new database is created; expand the Newly created database. Expand the Tables folder.
Right-click on the Tables Folder, Hover New, and then select Table.
Enter the table column names and data types one by one.
Right-click on the Column name field to assign Primary Key, Click on the First option, Set Primary Key.
Scroll down the column properties panel. Double click on the “Identity Specification” option to change it from No to Yes; it will assign the auto-increment property to the primary key.
Right-click on the table name and select Save Table or Press Ctrl + S keys.
Enter the table name and select, OK.
Right Click on the tables folder and then click on the refresh option.
The new table is added to the tables folder.
Similarly, create the second table.
Enter the table column names and datatypes one by one, select Primary key, assign identity column and save the table.

You can also create tables using the SQLQuery window.
Let’s build the third table using the SQLQuery window.
Keep the Tables folder selected; click on the New Query Option in the top menu options bar.
Write the Create Table SQL query,
Click on the Parse option to check for syntax errors.
After that, click on the Execute option to execute the SQL Query.
Refresh the Tables folder, and the table is successfully added to the tables folder.
Now, let’s create the relationships model using SQL Server.
Expand the Database Diagram folder, install any missing modules by clicking on the Yes option.
Right-click on the Database Diagrams folder, Select New Database Diagram, select the tables, and click on the Add button.
Arrange the tables by dragging the tables to the appropriate positions.
Click on the Primary key of the first table, and then click on the table where you want to use it as a reference key.
Check the Primary key and foreign key tables, and click on the OK button.
Similarly, make the relationship between the second and third table.
Right-click on the diagrams window and select Save Diagram, or Press Ctrl + S keys. Name the diagram and Press Enter.
The relationship table is created successfully; now, you can check the primary key and foreign keys for each table in the tables folder.
Right Click on one Table and Click on “Edit Top 200 Rows.”
Add records to the first table.
Now, Again right-click on the second table and select “Edit Top 200 Rows.”
Enter any record in the child table. The child table’s foreign key column gives an error because PackageID 4 is not present in the parent table, which means the relationship model is working well. Correct the data and press enter.

Here is a Bonus tip of the video:
By default, SQL Server Management Studio will not allow you to make any changes in the table design view after creating the relationship model; you can fix the issue by clicking on the tools item and then select Options…
Select Designers, and then Uncheck the option “Prevent saving changes that require table re-creation” click on the OK button.
I hope you’ll have learned something new from this video, You can ask questions and share suggestions in the comment section below this youtube video. Thank you so much for watching, and we’ll meet in the next video.

💡 TOPICS IN THIS VIDEO 💡
• SQL server database creation
• microsoft SQL server database creation
• microsoft SQL server
• sql server management studio
• database
• create table
• Database creation
• relational database table creation
• Microsoft SQL Server database creation
• SQL Server create tables
• sql server
• sql
• how to create a table in SQL server
• how to create a database in SQL server
• how to update in SQL server
• SQL Server- create a database
• Create Insert Update Delete SQL server
• create a database and table

🔎 HASHTAGS 🔎
#SQLserverdatabasecreation
#microsoftSQLserver
#database
#createtable
#Databasecreation
#sqlserver
#sql
#SQLServer-createadatabase
#createadatabaseandtable

Comments are closed.