CHECK constraint matching beginning of value

Advertisements We are using sqlite3 for a database and ensuring values inserted into a column matching a specific string would be useful in our case. Example: CREATE TABLE people ("firstname" TEXT), CHECK(LIKE(‘ca%’,"firstname")); The error we see is that sqlite3 gives this error: Parse error: near "CHECK": syntax error CREATE TABLE people ("firstname" TEXT), CHECK(LIKE(‘ca%’,"firstname")); error… Read More CHECK constraint matching beginning of value

PostgreSQL prevent row with null password when authentication type name is password

Advertisements I have 2 tables in PostgreSQL authentication_type id name created_at updated_at c1cc0489-4740-4dca-9d63-14e4c26093ad password … … accounts id email password authentication_type_id created_at updated_at … abc@example.com (foreign key to the other table) … … I would like to insert the row under the condition that When authentication type name is password, the value of the password… Read More PostgreSQL prevent row with null password when authentication type name is password

Why getting error: No matching unique or primary key for this column-list; if I have the same columns?

Advertisements I need to add a Foreign key to my Date_Reserved attribute in the Additional_extra Table, (Maybe because the Date type can’t be unique? I keep getting the next error: Error report – ORA-02270: no matching unique or primary key for this column-list 02270. 00000 – "no matching unique or primary key for this column-list"… Read More Why getting error: No matching unique or primary key for this column-list; if I have the same columns?

Swift iOS Layout Constraint. Using Constant that is proportional to view height programatically

Advertisements I am laying out a view programatically in Swift for iOS, but struggling to get my constraint quite how I want it. This is what I currently have: NSLayoutConstraint.activate([ Logo.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 30), Logo.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -30), Logo.heightAnchor.constraint(equalToConstant: 55), Logo.topAnchor.constraint(equalTo: label.bottomAnchor, constant: 150), ]) This is fine on large screens but as the screen… Read More Swift iOS Layout Constraint. Using Constant that is proportional to view height programatically

having difficulty with creating constraint in sqlite

Advertisements I have a table with contact as one of the column with constraint following the pattern of (000)0000000000 create table patient (USERNUM INT PRIMARY KEY, CONTACT varchar(15) constraint check_contact check (contact like ‘%([0-9]*3)[0-9]*10%’), age int constraint check_age check (age >0 and age <=100), location varchar(50) ); This does not allow me to insert the… Read More having difficulty with creating constraint in sqlite