存在actor表,包含如下列資訊:
現在在last_update後面新增加一列名字為create_date, 型別為datetime, not null,預設值為』0000 00:00:00』create
table
ifnot
exists actor (
actor_id smallint(5) not
null
primary
key,
first_name varchar(45) not
null,
last_name varchar(45) not
null,
last_update timestamp
notnull
default (datetime('now','localtime')));
本題考查的是資料庫表中新增一列並指定不為空(not null)和指定預設值(default 『0000-00-00 00:00:00』)
alter
table actor add
column create_date datetime not
null
default
'0000-00-00 00:00:00';
資料庫 指定列 指定id 查詢
簡單 資料庫 查詢 1.得到目標資料庫的cursor 如 聯絡人 cursor c getcontentresolver query people.content uri,null,null,null,null 2.查詢該資料庫中 指定id 指定列 的資料 public string getvalu...
SQL中如何給指定資料庫建立唯讀使用者?
在sql server 中,為了保護資料庫的安全,需要給不同的使用者開通不同的訪問使用者,那麼如何簡單的控制使用者的許可權呢?下面我們就建立乙個唯讀使用者,給大家學習使用。建立訪問指定資料庫的唯讀使用者 1 首先開啟 microsoft sqlserver management studio 用管理...
SQL資料庫新增新賬號,只操作指定資料庫
思路 1.建立資料庫伺服器登入使用者 2.建立指定資料庫的使用者,並且和伺服器使用者聯絡起來 3.給資料庫的使用者新增角色 實現 1.建立名為login的伺服器登入使用者dba,尼瑪dbpwd,預設資料庫mydb create login dba with password dbpwd defaul...