create or replace view view_all_members as
	select
		u.user_name,
		u.reg_tstamp,
		u.email,
		u.pwd,
		u.contact_phone as user_contact_phone,
		u.is_acknowledged,
		u.is_admin_acknowledged,
		m.*
	from users as u,members as m where
		u.user_id=m.user_id;

create or replace view view_active_members as
	select * from view_all_members where
		expires_tstamp>now() and 
		not is_deleted;

create or replace view view_active_freelancers as
	select * from view_active_members where member_type='freelancer';

create or replace view view_active_agencies as
	select * from view_active_members where member_type='agency';

create or replace view view_simple_users as
	select * from users where
		user_id not in (select user_id from members) and
		not is_deleted;
