admin

Create table

The syntax used to create a new table is as follows. column_constraint specifies the rules that the data stored in the column must follow.

Create Table As (CTAS)

The CREATE TABLE AS statement creates a new table and populates it with the queried data. The above query is executed to display the columns. As a result of the query, a table with 2 columns (rating, film_count) named film_reytingleri was created. Table data is taken from the film table.

Create Temporary Table

A temporary table is a transient table that exists for the duration of a database session. Temporary tables are automatically dropped at the end of a session or transaction. **A Temporary table is only visible to the session that created it. In other words, it is invisible to other sessions. PostgreSQL creates temporary tables in Create Temporary Table

Copy table

Copying a table completely, including both table structure and data The following expression is used for To copy the table structure without data, To copy some of the data from an existing table and create a new table; Example: As seen in the picture, the structure of the iletisim_backup table is the same as the Copy table

Transaction

It is a single business unit consisting of one or more transactions. A PostgreSQL transaction is atomic, consistent, isolated, and durable. -Atomic means that the transaction is completed as all or nothing (in case of a problem, it is written if it is committed, and if it is not, it is rollback). -Consistency ensures that Transaction

Commit

In order for the changes to be visible for other sessions (or users), it is necessary to perform the operation using the COMMIT statement: After executing the COMMIT statement, PostgreSQL also guarantees that if a crash occurs, the change will be permanent. If we use all these syntaxes together: Example: **Change is seen in the Commit

Rollback

It is used to undo the change of the current transaction. Example: When transferring to accounts, let’s make a transfer to the wrong account and cancel the change.

Update

Update is changing data in the table. The where statement is optional. If no condition is specified with where, the change is made in all the rows of the table Changed the value in the title column in the record with film_id = 999. If we didn’t specify where with the condition, all the values Update